Kaynağa Gözat

Added fields and bank entity

master
Kobus 5 yıl önce
ebeveyn
işleme
52b5091b38

+ 13
- 0
UnivateProperties_API/Containers/Timeshare/WeekFilterDto.cs Dosyayı Görüntüle

@@ -0,0 +1,13 @@
1
+using System;
2
+
3
+namespace UnivateProperties_API.Containers.Timeshare
4
+{
5
+    public class WeekFilterDto
6
+    {
7
+        public string RegionCode { get; set; }
8
+        public string ResortCode { get; set; }
9
+        public DateTime? Date { get; set; }
10
+        public double? MinAmount { get; set; }
11
+        public double? MaxAmount { get; set; }
12
+    }
13
+}

+ 3
- 0
UnivateProperties_API/Context/DataContext.cs Dosyayı Görüntüle

@@ -6,6 +6,7 @@ using UnivateProperties_API.Model.Region;
6 6
 using UnivateProperties_API.Model.Timeshare;
7 7
 using System.Linq;
8 8
 using UnivateProperties_API.Model;
9
+using UnivateProperties_API.Model.Bank;
9 10
 
10 11
 namespace UnivateProperties_API.Context
11 12
 {
@@ -50,6 +51,8 @@ namespace UnivateProperties_API.Context
50 51
         public DbSet<UnitConfiguration> UnitConfigurations { get; set; }
51 52
         public DbSet<UnitConfigurationType> UnitConfigurationTypes { get; set; }
52 53
         public DbSet<Season> Seasons { get; set; }
54
+        public DbSet<Bank> Banks { get; set; }
55
+        public DbSet<BankAccount> BankAccounts { get; set; }
53 56
         #endregion Timeshare
54 57
 
55 58
         public override int SaveChanges()

+ 12
- 0
UnivateProperties_API/Controllers/Timeshare/TimeshareWeekController.cs Dosyayı Görüntüle

@@ -1,7 +1,12 @@
1 1
 using Microsoft.AspNetCore.Mvc;
2
+using System;
3
+using System.Collections.Generic;
4
+using System.Linq;
2 5
 using System.Transactions;
6
+using UnivateProperties_API.Containers.Timeshare;
3 7
 using UnivateProperties_API.Model.Timeshare;
4 8
 using UnivateProperties_API.Repository;
9
+using UnivateProperties_API.Repository.Timeshare;
5 10
 
6 11
 namespace UnivateProperties_API.Controllers.Timeshare
7 12
 {
@@ -30,6 +35,13 @@ namespace UnivateProperties_API.Controllers.Timeshare
30 35
             return new OkObjectResult(item);
31 36
         }
32 37
 
38
+        [HttpGet("getBy")]
39
+        public IActionResult GetBy(WeekFilterDto week)
40
+        {
41
+            var item = (_Repo as WeekRepository).GetBy(week);
42
+            return new OkObjectResult(item);
43
+        }
44
+        
33 45
         [HttpPost]
34 46
         public IActionResult Post([FromBody] TimeshareWeek item)
35 47
         {

+ 771
- 0
UnivateProperties_API/Migrations/20190904110840_Initial.Designer.cs Dosyayı Görüntüle

@@ -0,0 +1,771 @@
1
+// <auto-generated />
2
+using System;
3
+using Microsoft.EntityFrameworkCore;
4
+using Microsoft.EntityFrameworkCore.Infrastructure;
5
+using Microsoft.EntityFrameworkCore.Migrations;
6
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
7
+using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
8
+using UnivateProperties_API.Context;
9
+
10
+namespace UnivateProperties_API.Migrations
11
+{
12
+    [DbContext(typeof(DataContext))]
13
+    [Migration("20190904110840_Initial")]
14
+    partial class Initial
15
+    {
16
+        protected override void BuildTargetModel(ModelBuilder modelBuilder)
17
+        {
18
+#pragma warning disable 612, 618
19
+            modelBuilder
20
+                .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn)
21
+                .HasAnnotation("ProductVersion", "2.2.4-servicing-10062")
22
+                .HasAnnotation("Relational:MaxIdentifierLength", 63);
23
+
24
+            modelBuilder.Entity("UnivateProperties_API.Model.Communication.Email", b =>
25
+                {
26
+                    b.Property<int>("Id")
27
+                        .ValueGeneratedOnAdd();
28
+
29
+                    b.Property<string>("BCC");
30
+
31
+                    b.Property<string>("Body");
32
+
33
+                    b.Property<string>("CC");
34
+
35
+                    b.Property<string>("Comment");
36
+
37
+                    b.Property<DateTime>("Created");
38
+
39
+                    b.Property<bool>("IsBodyHtml");
40
+
41
+                    b.Property<DateTime>("Modified");
42
+
43
+                    b.Property<string>("ModifiedBy");
44
+
45
+                    b.Property<int>("SenderId");
46
+
47
+                    b.Property<string>("Subject");
48
+
49
+                    b.Property<string>("To");
50
+
51
+                    b.Property<string>("ToDisplay");
52
+
53
+                    b.HasKey("Id");
54
+
55
+                    b.HasIndex("SenderId");
56
+
57
+                    b.ToTable("Emails");
58
+                });
59
+
60
+            modelBuilder.Entity("UnivateProperties_API.Model.Communication.SMTPAccount", b =>
61
+                {
62
+                    b.Property<int>("Id")
63
+                        .ValueGeneratedOnAdd();
64
+
65
+                    b.Property<string>("Address");
66
+
67
+                    b.Property<DateTime>("Created");
68
+
69
+                    b.Property<string>("DisplayName");
70
+
71
+                    b.Property<DateTime>("Modified");
72
+
73
+                    b.Property<string>("ModifiedBy");
74
+
75
+                    b.Property<int>("SMTPHostId");
76
+
77
+                    b.HasKey("Id");
78
+
79
+                    b.HasIndex("SMTPHostId");
80
+
81
+                    b.ToTable("Accounts");
82
+                });
83
+
84
+            modelBuilder.Entity("UnivateProperties_API.Model.Communication.SMTPHost", b =>
85
+                {
86
+                    b.Property<int>("Id")
87
+                        .ValueGeneratedOnAdd();
88
+
89
+                    b.Property<DateTime>("Created");
90
+
91
+                    b.Property<string>("Host");
92
+
93
+                    b.Property<DateTime>("Modified");
94
+
95
+                    b.Property<string>("ModifiedBy");
96
+
97
+                    b.Property<bool>("NeedsAuthorize");
98
+
99
+                    b.Property<string>("Password");
100
+
101
+                    b.Property<bool>("UseSSL");
102
+
103
+                    b.Property<string>("User");
104
+
105
+                    b.HasKey("Id");
106
+
107
+                    b.ToTable("Hosts");
108
+                });
109
+
110
+            modelBuilder.Entity("UnivateProperties_API.Model.Property.Property", b =>
111
+                {
112
+                    b.Property<int>("Id")
113
+                        .ValueGeneratedOnAdd();
114
+
115
+                    b.Property<string>("AddressLine1");
116
+
117
+                    b.Property<string>("AddressLine2");
118
+
119
+                    b.Property<string>("AddressLine3");
120
+
121
+                    b.Property<int>("CityId");
122
+
123
+                    b.Property<DateTime>("Created");
124
+
125
+                    b.Property<string>("CreatedBy");
126
+
127
+                    b.Property<string>("Description");
128
+
129
+                    b.Property<bool>("IsSale");
130
+
131
+                    b.Property<DateTime>("Modified");
132
+
133
+                    b.Property<string>("ModifiedBy");
134
+
135
+                    b.Property<decimal>("OperationalCosts");
136
+
137
+                    b.Property<decimal>("Price");
138
+
139
+                    b.Property<string>("PricePer");
140
+
141
+                    b.Property<string>("PropertyName");
142
+
143
+                    b.Property<int>("PropertyTypeId");
144
+
145
+                    b.Property<int>("ProvinceId");
146
+
147
+                    b.Property<bool>("Published");
148
+
149
+                    b.Property<string>("ShortDescription");
150
+
151
+                    b.Property<int>("SuburbId");
152
+
153
+                    b.Property<string>("Unit");
154
+
155
+                    b.HasKey("Id");
156
+
157
+                    b.HasIndex("CityId");
158
+
159
+                    b.HasIndex("PropertyTypeId");
160
+
161
+                    b.HasIndex("ProvinceId");
162
+
163
+                    b.HasIndex("SuburbId");
164
+
165
+                    b.ToTable("Properties");
166
+                });
167
+
168
+            modelBuilder.Entity("UnivateProperties_API.Model.Property.PropertyImage", b =>
169
+                {
170
+                    b.Property<int>("Id")
171
+                        .ValueGeneratedOnAdd();
172
+
173
+                    b.Property<DateTime>("Created");
174
+
175
+                    b.Property<string>("Image");
176
+
177
+                    b.Property<bool>("IsDefault");
178
+
179
+                    b.Property<DateTime>("Modified");
180
+
181
+                    b.Property<string>("ModifiedBy");
182
+
183
+                    b.Property<int>("PropertyId");
184
+
185
+                    b.HasKey("Id");
186
+
187
+                    b.HasIndex("PropertyId");
188
+
189
+                    b.ToTable("PropertyImages");
190
+                });
191
+
192
+            modelBuilder.Entity("UnivateProperties_API.Model.Property.PropertyType", b =>
193
+                {
194
+                    b.Property<int>("Id")
195
+                        .ValueGeneratedOnAdd();
196
+
197
+                    b.Property<DateTime>("Created");
198
+
199
+                    b.Property<string>("Description");
200
+
201
+                    b.Property<DateTime>("Modified");
202
+
203
+                    b.Property<string>("ModifiedBy");
204
+
205
+                    b.Property<int>("UsageType");
206
+
207
+                    b.HasKey("Id");
208
+
209
+                    b.ToTable("PropertyTypes");
210
+                });
211
+
212
+            modelBuilder.Entity("UnivateProperties_API.Model.Property.PropertyUserField", b =>
213
+                {
214
+                    b.Property<int>("Id")
215
+                        .ValueGeneratedOnAdd();
216
+
217
+                    b.Property<DateTime>("Created");
218
+
219
+                    b.Property<string>("Description");
220
+
221
+                    b.Property<DateTime>("Modified");
222
+
223
+                    b.Property<string>("ModifiedBy");
224
+
225
+                    b.Property<int>("PropertyId");
226
+
227
+                    b.Property<int>("UserDefinedFieldId");
228
+
229
+                    b.Property<string>("Value");
230
+
231
+                    b.HasKey("Id");
232
+
233
+                    b.HasIndex("PropertyId");
234
+
235
+                    b.HasIndex("UserDefinedFieldId");
236
+
237
+                    b.ToTable("PropertyUserFields");
238
+                });
239
+
240
+            modelBuilder.Entity("UnivateProperties_API.Model.Property.UserDefinedField", b =>
241
+                {
242
+                    b.Property<int>("Id")
243
+                        .ValueGeneratedOnAdd();
244
+
245
+                    b.Property<DateTime>("Created");
246
+
247
+                    b.Property<string>("FieldName");
248
+
249
+                    b.Property<string>("FieldType");
250
+
251
+                    b.Property<int>("GroupId");
252
+
253
+                    b.Property<DateTime>("Modified");
254
+
255
+                    b.Property<string>("ModifiedBy");
256
+
257
+                    b.Property<int>("Rank");
258
+
259
+                    b.HasKey("Id");
260
+
261
+                    b.HasIndex("GroupId");
262
+
263
+                    b.ToTable("UserDefinedFields");
264
+                });
265
+
266
+            modelBuilder.Entity("UnivateProperties_API.Model.Property.UserDefinedGroup", b =>
267
+                {
268
+                    b.Property<int>("Id")
269
+                        .ValueGeneratedOnAdd();
270
+
271
+                    b.Property<DateTime>("Created");
272
+
273
+                    b.Property<string>("Description");
274
+
275
+                    b.Property<DateTime>("Modified");
276
+
277
+                    b.Property<string>("ModifiedBy");
278
+
279
+                    b.Property<int>("Rank");
280
+
281
+                    b.Property<int>("UsageType");
282
+
283
+                    b.HasKey("Id");
284
+
285
+                    b.ToTable("UserDefinedGroups");
286
+                });
287
+
288
+            modelBuilder.Entity("UnivateProperties_API.Model.Region.City", b =>
289
+                {
290
+                    b.Property<int>("Id")
291
+                        .ValueGeneratedOnAdd();
292
+
293
+                    b.Property<string>("Code");
294
+
295
+                    b.Property<DateTime>("Created");
296
+
297
+                    b.Property<string>("Description");
298
+
299
+                    b.Property<DateTime>("Modified");
300
+
301
+                    b.Property<string>("ModifiedBy");
302
+
303
+                    b.Property<int>("ProvinceId");
304
+
305
+                    b.HasKey("Id");
306
+
307
+                    b.HasIndex("ProvinceId");
308
+
309
+                    b.ToTable("Cities");
310
+                });
311
+
312
+            modelBuilder.Entity("UnivateProperties_API.Model.Region.Province", b =>
313
+                {
314
+                    b.Property<int>("Id")
315
+                        .ValueGeneratedOnAdd();
316
+
317
+                    b.Property<string>("Code");
318
+
319
+                    b.Property<DateTime>("Created");
320
+
321
+                    b.Property<string>("Description");
322
+
323
+                    b.Property<DateTime>("Modified");
324
+
325
+                    b.Property<string>("ModifiedBy");
326
+
327
+                    b.HasKey("Id");
328
+
329
+                    b.ToTable("Provinces");
330
+                });
331
+
332
+            modelBuilder.Entity("UnivateProperties_API.Model.Region.Suburb", b =>
333
+                {
334
+                    b.Property<int>("Id")
335
+                        .ValueGeneratedOnAdd();
336
+
337
+                    b.Property<int>("CityId");
338
+
339
+                    b.Property<DateTime>("Created");
340
+
341
+                    b.Property<string>("Description");
342
+
343
+                    b.Property<DateTime>("Modified");
344
+
345
+                    b.Property<string>("ModifiedBy");
346
+
347
+                    b.Property<string>("PostalCode");
348
+
349
+                    b.HasKey("Id");
350
+
351
+                    b.HasIndex("CityId");
352
+
353
+                    b.ToTable("Suburbs");
354
+                });
355
+
356
+            modelBuilder.Entity("UnivateProperties_API.Model.Timeshare.Season", b =>
357
+                {
358
+                    b.Property<int>("Id")
359
+                        .ValueGeneratedOnAdd();
360
+
361
+                    b.Property<DateTime>("Created");
362
+
363
+                    b.Property<DateTime>("Modified");
364
+
365
+                    b.Property<string>("ModifiedBy");
366
+
367
+                    b.Property<string>("Name");
368
+
369
+                    b.HasKey("Id");
370
+
371
+                    b.ToTable("Seasons");
372
+                });
373
+
374
+            modelBuilder.Entity("UnivateProperties_API.Model.Timeshare.Status", b =>
375
+                {
376
+                    b.Property<int>("Id")
377
+                        .ValueGeneratedOnAdd();
378
+
379
+                    b.Property<string>("Code");
380
+
381
+                    b.Property<DateTime>("Created");
382
+
383
+                    b.Property<string>("Description");
384
+
385
+                    b.Property<DateTime>("Modified");
386
+
387
+                    b.Property<string>("ModifiedBy");
388
+
389
+                    b.Property<int>("StatusType");
390
+
391
+                    b.HasKey("Id");
392
+
393
+                    b.ToTable("Status");
394
+                });
395
+
396
+            modelBuilder.Entity("UnivateProperties_API.Model.Timeshare.TimeshareWeek", b =>
397
+                {
398
+                    b.Property<int>("Id")
399
+                        .ValueGeneratedOnAdd();
400
+
401
+                    b.Property<int?>("AgencyId");
402
+
403
+                    b.Property<int?>("AgentId");
404
+
405
+                    b.Property<DateTime>("ArrivalDate");
406
+
407
+                    b.Property<string>("BankedWith");
408
+
409
+                    b.Property<int>("Bedrooms");
410
+
411
+                    b.Property<DateTime>("Created");
412
+
413
+                    b.Property<bool>("CurrentYearBanked");
414
+
415
+                    b.Property<DateTime>("DepartureDate");
416
+
417
+                    b.Property<bool>("LeviesPaidInFull");
418
+
419
+                    b.Property<double>("LevyAmount");
420
+
421
+                    b.Property<int>("MaxSleep");
422
+
423
+                    b.Property<DateTime>("Modified");
424
+
425
+                    b.Property<string>("ModifiedBy");
426
+
427
+                    b.Property<string>("Module");
428
+
429
+                    b.Property<DateTime>("OriginalPurchaseDate");
430
+
431
+                    b.Property<double>("OriginalPurchasePrice");
432
+
433
+                    b.Property<bool>("OtherResort");
434
+
435
+                    b.Property<int>("OwnerId");
436
+
437
+                    b.Property<bool>("ReferedByAgent");
438
+
439
+                    b.Property<int>("RegionId");
440
+
441
+                    b.Property<string>("ResortCode");
442
+
443
+                    b.Property<string>("ResortName");
444
+
445
+                    b.Property<string>("Season");
446
+
447
+                    b.Property<int>("StatusId");
448
+
449
+                    b.Property<string>("WeekNumber");
450
+
451
+                    b.Property<bool>("WeekPlacedForRental");
452
+
453
+                    b.HasKey("Id");
454
+
455
+                    b.HasIndex("AgencyId");
456
+
457
+                    b.HasIndex("AgentId");
458
+
459
+                    b.HasIndex("OwnerId");
460
+
461
+                    b.HasIndex("RegionId");
462
+
463
+                    b.HasIndex("StatusId");
464
+
465
+                    b.ToTable("Weeks");
466
+                });
467
+
468
+            modelBuilder.Entity("UnivateProperties_API.Model.Timeshare.UnitConfiguration", b =>
469
+                {
470
+                    b.Property<int>("Id")
471
+                        .ValueGeneratedOnAdd();
472
+
473
+                    b.Property<int>("Adults");
474
+
475
+                    b.Property<int>("Bedrooms");
476
+
477
+                    b.Property<int>("Children");
478
+
479
+                    b.Property<string>("Code");
480
+
481
+                    b.Property<DateTime>("Created");
482
+
483
+                    b.Property<DateTime>("Modified");
484
+
485
+                    b.Property<string>("ModifiedBy");
486
+
487
+                    b.HasKey("Id");
488
+
489
+                    b.HasIndex("Code")
490
+                        .IsUnique();
491
+
492
+                    b.ToTable("UnitConfigurations");
493
+                });
494
+
495
+            modelBuilder.Entity("UnivateProperties_API.Model.Timeshare.UnitConfigurationType", b =>
496
+                {
497
+                    b.Property<int>("Id")
498
+                        .ValueGeneratedOnAdd();
499
+
500
+                    b.Property<DateTime>("Created");
501
+
502
+                    b.Property<string>("Description");
503
+
504
+                    b.Property<DateTime>("Modified");
505
+
506
+                    b.Property<string>("ModifiedBy");
507
+
508
+                    b.Property<int>("UnitConfigurationId");
509
+
510
+                    b.HasKey("Id");
511
+
512
+                    b.HasIndex("UnitConfigurationId");
513
+
514
+                    b.ToTable("UnitConfigurationTypes");
515
+                });
516
+
517
+            modelBuilder.Entity("UnivateProperties_API.Model.Users.Agency", b =>
518
+                {
519
+                    b.Property<int>("Id")
520
+                        .ValueGeneratedOnAdd();
521
+
522
+                    b.Property<string>("AgencyName");
523
+
524
+                    b.Property<string>("CompanyRegNumber");
525
+
526
+                    b.Property<DateTime>("Created");
527
+
528
+                    b.Property<string>("EAABEFFCNumber");
529
+
530
+                    b.Property<DateTime>("Modified");
531
+
532
+                    b.Property<string>("ModifiedBy");
533
+
534
+                    b.HasKey("Id");
535
+
536
+                    b.ToTable("Agencies");
537
+                });
538
+
539
+            modelBuilder.Entity("UnivateProperties_API.Model.Users.Agent", b =>
540
+                {
541
+                    b.Property<int>("Id")
542
+                        .ValueGeneratedOnAdd();
543
+
544
+                    b.Property<int?>("AgencyId");
545
+
546
+                    b.Property<string>("CellNumber");
547
+
548
+                    b.Property<DateTime>("Created");
549
+
550
+                    b.Property<string>("Email");
551
+
552
+                    b.Property<DateTime>("Modified");
553
+
554
+                    b.Property<string>("ModifiedBy");
555
+
556
+                    b.Property<string>("Name");
557
+
558
+                    b.Property<string>("Surname");
559
+
560
+                    b.Property<string>("Telephone");
561
+
562
+                    b.Property<int>("UserId");
563
+
564
+                    b.HasKey("Id");
565
+
566
+                    b.HasIndex("AgencyId");
567
+
568
+                    b.HasIndex("UserId");
569
+
570
+                    b.ToTable("Agents");
571
+                });
572
+
573
+            modelBuilder.Entity("UnivateProperties_API.Model.Users.Individual", b =>
574
+                {
575
+                    b.Property<int>("Id")
576
+                        .ValueGeneratedOnAdd();
577
+
578
+                    b.Property<string>("CellNumber");
579
+
580
+                    b.Property<DateTime>("Created");
581
+
582
+                    b.Property<string>("Email");
583
+
584
+                    b.Property<DateTime>("Modified");
585
+
586
+                    b.Property<string>("ModifiedBy");
587
+
588
+                    b.Property<string>("Name");
589
+
590
+                    b.Property<string>("Surname");
591
+
592
+                    b.Property<string>("Telephone");
593
+
594
+                    b.Property<int>("UserId");
595
+
596
+                    b.HasKey("Id");
597
+
598
+                    b.HasIndex("UserId");
599
+
600
+                    b.ToTable("Individuals");
601
+                });
602
+
603
+            modelBuilder.Entity("UnivateProperties_API.Model.Users.User", b =>
604
+                {
605
+                    b.Property<int>("Id")
606
+                        .ValueGeneratedOnAdd();
607
+
608
+                    b.Property<DateTime>("Created");
609
+
610
+                    b.Property<DateTime>("Modified");
611
+
612
+                    b.Property<string>("ModifiedBy");
613
+
614
+                    b.Property<byte[]>("PasswordHash");
615
+
616
+                    b.Property<byte[]>("PasswordSalt");
617
+
618
+                    b.Property<string>("Role");
619
+
620
+                    b.Property<string>("Token");
621
+
622
+                    b.Property<string>("Username");
623
+
624
+                    b.Property<bool>("Verified");
625
+
626
+                    b.HasKey("Id");
627
+
628
+                    b.ToTable("Users");
629
+                });
630
+
631
+            modelBuilder.Entity("UnivateProperties_API.Model.Communication.Email", b =>
632
+                {
633
+                    b.HasOne("UnivateProperties_API.Model.Communication.SMTPAccount", "Sender")
634
+                        .WithMany("Emails")
635
+                        .HasForeignKey("SenderId")
636
+                        .OnDelete(DeleteBehavior.Cascade);
637
+                });
638
+
639
+            modelBuilder.Entity("UnivateProperties_API.Model.Communication.SMTPAccount", b =>
640
+                {
641
+                    b.HasOne("UnivateProperties_API.Model.Communication.SMTPHost", "SMTPHost")
642
+                        .WithMany("SMTPAccounts")
643
+                        .HasForeignKey("SMTPHostId")
644
+                        .OnDelete(DeleteBehavior.Cascade);
645
+                });
646
+
647
+            modelBuilder.Entity("UnivateProperties_API.Model.Property.Property", b =>
648
+                {
649
+                    b.HasOne("UnivateProperties_API.Model.Region.City", "City")
650
+                        .WithMany()
651
+                        .HasForeignKey("CityId")
652
+                        .OnDelete(DeleteBehavior.Cascade);
653
+
654
+                    b.HasOne("UnivateProperties_API.Model.Property.PropertyType", "PropertyType")
655
+                        .WithMany()
656
+                        .HasForeignKey("PropertyTypeId")
657
+                        .OnDelete(DeleteBehavior.Cascade);
658
+
659
+                    b.HasOne("UnivateProperties_API.Model.Region.Province", "Province")
660
+                        .WithMany()
661
+                        .HasForeignKey("ProvinceId")
662
+                        .OnDelete(DeleteBehavior.Cascade);
663
+
664
+                    b.HasOne("UnivateProperties_API.Model.Region.Suburb", "Suburb")
665
+                        .WithMany()
666
+                        .HasForeignKey("SuburbId")
667
+                        .OnDelete(DeleteBehavior.Cascade);
668
+                });
669
+
670
+            modelBuilder.Entity("UnivateProperties_API.Model.Property.PropertyImage", b =>
671
+                {
672
+                    b.HasOne("UnivateProperties_API.Model.Property.Property", "Property")
673
+                        .WithMany("PropertyImages")
674
+                        .HasForeignKey("PropertyId")
675
+                        .OnDelete(DeleteBehavior.Cascade);
676
+                });
677
+
678
+            modelBuilder.Entity("UnivateProperties_API.Model.Property.PropertyUserField", b =>
679
+                {
680
+                    b.HasOne("UnivateProperties_API.Model.Property.Property", "Property")
681
+                        .WithMany("PropertyUserFields")
682
+                        .HasForeignKey("PropertyId")
683
+                        .OnDelete(DeleteBehavior.Cascade);
684
+
685
+                    b.HasOne("UnivateProperties_API.Model.Property.UserDefinedField", "UserDefinedField")
686
+                        .WithMany()
687
+                        .HasForeignKey("UserDefinedFieldId")
688
+                        .OnDelete(DeleteBehavior.Cascade);
689
+                });
690
+
691
+            modelBuilder.Entity("UnivateProperties_API.Model.Property.UserDefinedField", b =>
692
+                {
693
+                    b.HasOne("UnivateProperties_API.Model.Property.UserDefinedGroup", "Group")
694
+                        .WithMany("Fields")
695
+                        .HasForeignKey("GroupId")
696
+                        .OnDelete(DeleteBehavior.Cascade);
697
+                });
698
+
699
+            modelBuilder.Entity("UnivateProperties_API.Model.Region.City", b =>
700
+                {
701
+                    b.HasOne("UnivateProperties_API.Model.Region.Province", "Province")
702
+                        .WithMany()
703
+                        .HasForeignKey("ProvinceId")
704
+                        .OnDelete(DeleteBehavior.Cascade);
705
+                });
706
+
707
+            modelBuilder.Entity("UnivateProperties_API.Model.Region.Suburb", b =>
708
+                {
709
+                    b.HasOne("UnivateProperties_API.Model.Region.City", "City")
710
+                        .WithMany()
711
+                        .HasForeignKey("CityId")
712
+                        .OnDelete(DeleteBehavior.Cascade);
713
+                });
714
+
715
+            modelBuilder.Entity("UnivateProperties_API.Model.Timeshare.TimeshareWeek", b =>
716
+                {
717
+                    b.HasOne("UnivateProperties_API.Model.Users.Agency", "Agency")
718
+                        .WithMany()
719
+                        .HasForeignKey("AgencyId");
720
+
721
+                    b.HasOne("UnivateProperties_API.Model.Users.Agent", "Agent")
722
+                        .WithMany()
723
+                        .HasForeignKey("AgentId");
724
+
725
+                    b.HasOne("UnivateProperties_API.Model.Users.Individual", "Owner")
726
+                        .WithMany()
727
+                        .HasForeignKey("OwnerId")
728
+                        .OnDelete(DeleteBehavior.Cascade);
729
+
730
+                    b.HasOne("UnivateProperties_API.Model.Region.Province", "Region")
731
+                        .WithMany()
732
+                        .HasForeignKey("RegionId")
733
+                        .OnDelete(DeleteBehavior.Cascade);
734
+
735
+                    b.HasOne("UnivateProperties_API.Model.Timeshare.Status", "Status")
736
+                        .WithMany()
737
+                        .HasForeignKey("StatusId")
738
+                        .OnDelete(DeleteBehavior.Cascade);
739
+                });
740
+
741
+            modelBuilder.Entity("UnivateProperties_API.Model.Timeshare.UnitConfigurationType", b =>
742
+                {
743
+                    b.HasOne("UnivateProperties_API.Model.Timeshare.UnitConfiguration", "UnitConfiguration")
744
+                        .WithMany("Types")
745
+                        .HasForeignKey("UnitConfigurationId")
746
+                        .OnDelete(DeleteBehavior.Cascade);
747
+                });
748
+
749
+            modelBuilder.Entity("UnivateProperties_API.Model.Users.Agent", b =>
750
+                {
751
+                    b.HasOne("UnivateProperties_API.Model.Users.Agency", "Agency")
752
+                        .WithMany("Agents")
753
+                        .HasForeignKey("AgencyId");
754
+
755
+                    b.HasOne("UnivateProperties_API.Model.Users.User", "User")
756
+                        .WithMany()
757
+                        .HasForeignKey("UserId")
758
+                        .OnDelete(DeleteBehavior.Cascade);
759
+                });
760
+
761
+            modelBuilder.Entity("UnivateProperties_API.Model.Users.Individual", b =>
762
+                {
763
+                    b.HasOne("UnivateProperties_API.Model.Users.User", "User")
764
+                        .WithMany()
765
+                        .HasForeignKey("UserId")
766
+                        .OnDelete(DeleteBehavior.Cascade);
767
+                });
768
+#pragma warning restore 612, 618
769
+        }
770
+    }
771
+}

UnivateProperties_API/Migrations/20190903062247_initial.cs → UnivateProperties_API/Migrations/20190904110840_Initial.cs Dosyayı Görüntüle

@@ -4,7 +4,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
4 4
 
5 5
 namespace UnivateProperties_API.Migrations
6 6
 {
7
-    public partial class initial : Migration
7
+    public partial class Initial : Migration
8 8
     {
9 9
         protected override void Up(MigrationBuilder migrationBuilder)
10 10
         {
@@ -160,8 +160,6 @@ namespace UnivateProperties_API.Migrations
160 160
                     Created = table.Column<DateTime>(nullable: false),
161 161
                     Modified = table.Column<DateTime>(nullable: false),
162 162
                     ModifiedBy = table.Column<string>(nullable: true),
163
-                    Name = table.Column<string>(nullable: true),
164
-                    Surname = table.Column<string>(nullable: true),
165 163
                     Username = table.Column<string>(nullable: true),
166 164
                     Role = table.Column<string>(nullable: true),
167 165
                     PasswordHash = table.Column<byte[]>(nullable: true),
@@ -434,9 +432,9 @@ namespace UnivateProperties_API.Migrations
434 432
                         principalColumn: "Id",
435 433
                         onDelete: ReferentialAction.Restrict);
436 434
                     table.ForeignKey(
437
-                        name: "FK_Weeks_Users_OwnerId",
435
+                        name: "FK_Weeks_Individuals_OwnerId",
438 436
                         column: x => x.OwnerId,
439
-                        principalTable: "Users",
437
+                        principalTable: "Individuals",
440 438
                         principalColumn: "Id",
441 439
                         onDelete: ReferentialAction.Cascade);
442 440
                     table.ForeignKey(
@@ -681,9 +679,6 @@ namespace UnivateProperties_API.Migrations
681 679
             migrationBuilder.DropTable(
682 680
                 name: "Emails");
683 681
 
684
-            migrationBuilder.DropTable(
685
-                name: "Individuals");
686
-
687 682
             migrationBuilder.DropTable(
688 683
                 name: "PropertyImages");
689 684
 
@@ -714,6 +709,9 @@ namespace UnivateProperties_API.Migrations
714 709
             migrationBuilder.DropTable(
715 710
                 name: "Agents");
716 711
 
712
+            migrationBuilder.DropTable(
713
+                name: "Individuals");
714
+
717 715
             migrationBuilder.DropTable(
718 716
                 name: "Status");
719 717
 

UnivateProperties_API/Migrations/20190903062247_initial.Designer.cs → UnivateProperties_API/Migrations/20190904111234_AgentAsRep.Designer.cs Dosyayı Görüntüle

@@ -10,8 +10,8 @@ using UnivateProperties_API.Context;
10 10
 namespace UnivateProperties_API.Migrations
11 11
 {
12 12
     [DbContext(typeof(DataContext))]
13
-    [Migration("20190903062247_initial")]
14
-    partial class initial
13
+    [Migration("20190904111234_AgentAsRep")]
14
+    partial class AgentAsRep
15 15
     {
16 16
         protected override void BuildTargetModel(ModelBuilder modelBuilder)
17 17
         {
@@ -400,6 +400,8 @@ namespace UnivateProperties_API.Migrations
400 400
 
401 401
                     b.Property<int?>("AgencyId");
402 402
 
403
+                    b.Property<bool>("AgentAsRep");
404
+
403 405
                     b.Property<int?>("AgentId");
404 406
 
405 407
                     b.Property<DateTime>("ArrivalDate");
@@ -611,16 +613,12 @@ namespace UnivateProperties_API.Migrations
611 613
 
612 614
                     b.Property<string>("ModifiedBy");
613 615
 
614
-                    b.Property<string>("Name");
615
-
616 616
                     b.Property<byte[]>("PasswordHash");
617 617
 
618 618
                     b.Property<byte[]>("PasswordSalt");
619 619
 
620 620
                     b.Property<string>("Role");
621 621
 
622
-                    b.Property<string>("Surname");
623
-
624 622
                     b.Property<string>("Token");
625 623
 
626 624
                     b.Property<string>("Username");
@@ -726,7 +724,7 @@ namespace UnivateProperties_API.Migrations
726 724
                         .WithMany()
727 725
                         .HasForeignKey("AgentId");
728 726
 
729
-                    b.HasOne("UnivateProperties_API.Model.Users.User", "Owner")
727
+                    b.HasOne("UnivateProperties_API.Model.Users.Individual", "Owner")
730 728
                         .WithMany()
731 729
                         .HasForeignKey("OwnerId")
732 730
                         .OnDelete(DeleteBehavior.Cascade);

+ 23
- 0
UnivateProperties_API/Migrations/20190904111234_AgentAsRep.cs Dosyayı Görüntüle

@@ -0,0 +1,23 @@
1
+using Microsoft.EntityFrameworkCore.Migrations;
2
+
3
+namespace UnivateProperties_API.Migrations
4
+{
5
+    public partial class AgentAsRep : Migration
6
+    {
7
+        protected override void Up(MigrationBuilder migrationBuilder)
8
+        {
9
+            migrationBuilder.AddColumn<bool>(
10
+                name: "AgentAsRep",
11
+                table: "Weeks",
12
+                nullable: false,
13
+                defaultValue: false);
14
+        }
15
+
16
+        protected override void Down(MigrationBuilder migrationBuilder)
17
+        {
18
+            migrationBuilder.DropColumn(
19
+                name: "AgentAsRep",
20
+                table: "Weeks");
21
+        }
22
+    }
23
+}

+ 775
- 0
UnivateProperties_API/Migrations/20190905084739_AddedSellPrice.Designer.cs Dosyayı Görüntüle

@@ -0,0 +1,775 @@
1
+// <auto-generated />
2
+using System;
3
+using Microsoft.EntityFrameworkCore;
4
+using Microsoft.EntityFrameworkCore.Infrastructure;
5
+using Microsoft.EntityFrameworkCore.Migrations;
6
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
7
+using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
8
+using UnivateProperties_API.Context;
9
+
10
+namespace UnivateProperties_API.Migrations
11
+{
12
+    [DbContext(typeof(DataContext))]
13
+    [Migration("20190905084739_AddedSellPrice")]
14
+    partial class AddedSellPrice
15
+    {
16
+        protected override void BuildTargetModel(ModelBuilder modelBuilder)
17
+        {
18
+#pragma warning disable 612, 618
19
+            modelBuilder
20
+                .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn)
21
+                .HasAnnotation("ProductVersion", "2.2.4-servicing-10062")
22
+                .HasAnnotation("Relational:MaxIdentifierLength", 63);
23
+
24
+            modelBuilder.Entity("UnivateProperties_API.Model.Communication.Email", b =>
25
+                {
26
+                    b.Property<int>("Id")
27
+                        .ValueGeneratedOnAdd();
28
+
29
+                    b.Property<string>("BCC");
30
+
31
+                    b.Property<string>("Body");
32
+
33
+                    b.Property<string>("CC");
34
+
35
+                    b.Property<string>("Comment");
36
+
37
+                    b.Property<DateTime>("Created");
38
+
39
+                    b.Property<bool>("IsBodyHtml");
40
+
41
+                    b.Property<DateTime>("Modified");
42
+
43
+                    b.Property<string>("ModifiedBy");
44
+
45
+                    b.Property<int>("SenderId");
46
+
47
+                    b.Property<string>("Subject");
48
+
49
+                    b.Property<string>("To");
50
+
51
+                    b.Property<string>("ToDisplay");
52
+
53
+                    b.HasKey("Id");
54
+
55
+                    b.HasIndex("SenderId");
56
+
57
+                    b.ToTable("Emails");
58
+                });
59
+
60
+            modelBuilder.Entity("UnivateProperties_API.Model.Communication.SMTPAccount", b =>
61
+                {
62
+                    b.Property<int>("Id")
63
+                        .ValueGeneratedOnAdd();
64
+
65
+                    b.Property<string>("Address");
66
+
67
+                    b.Property<DateTime>("Created");
68
+
69
+                    b.Property<string>("DisplayName");
70
+
71
+                    b.Property<DateTime>("Modified");
72
+
73
+                    b.Property<string>("ModifiedBy");
74
+
75
+                    b.Property<int>("SMTPHostId");
76
+
77
+                    b.HasKey("Id");
78
+
79
+                    b.HasIndex("SMTPHostId");
80
+
81
+                    b.ToTable("Accounts");
82
+                });
83
+
84
+            modelBuilder.Entity("UnivateProperties_API.Model.Communication.SMTPHost", b =>
85
+                {
86
+                    b.Property<int>("Id")
87
+                        .ValueGeneratedOnAdd();
88
+
89
+                    b.Property<DateTime>("Created");
90
+
91
+                    b.Property<string>("Host");
92
+
93
+                    b.Property<DateTime>("Modified");
94
+
95
+                    b.Property<string>("ModifiedBy");
96
+
97
+                    b.Property<bool>("NeedsAuthorize");
98
+
99
+                    b.Property<string>("Password");
100
+
101
+                    b.Property<bool>("UseSSL");
102
+
103
+                    b.Property<string>("User");
104
+
105
+                    b.HasKey("Id");
106
+
107
+                    b.ToTable("Hosts");
108
+                });
109
+
110
+            modelBuilder.Entity("UnivateProperties_API.Model.Property.Property", b =>
111
+                {
112
+                    b.Property<int>("Id")
113
+                        .ValueGeneratedOnAdd();
114
+
115
+                    b.Property<string>("AddressLine1");
116
+
117
+                    b.Property<string>("AddressLine2");
118
+
119
+                    b.Property<string>("AddressLine3");
120
+
121
+                    b.Property<int>("CityId");
122
+
123
+                    b.Property<DateTime>("Created");
124
+
125
+                    b.Property<string>("CreatedBy");
126
+
127
+                    b.Property<string>("Description");
128
+
129
+                    b.Property<bool>("IsSale");
130
+
131
+                    b.Property<DateTime>("Modified");
132
+
133
+                    b.Property<string>("ModifiedBy");
134
+
135
+                    b.Property<decimal>("OperationalCosts");
136
+
137
+                    b.Property<decimal>("Price");
138
+
139
+                    b.Property<string>("PricePer");
140
+
141
+                    b.Property<string>("PropertyName");
142
+
143
+                    b.Property<int>("PropertyTypeId");
144
+
145
+                    b.Property<int>("ProvinceId");
146
+
147
+                    b.Property<bool>("Published");
148
+
149
+                    b.Property<string>("ShortDescription");
150
+
151
+                    b.Property<int>("SuburbId");
152
+
153
+                    b.Property<string>("Unit");
154
+
155
+                    b.HasKey("Id");
156
+
157
+                    b.HasIndex("CityId");
158
+
159
+                    b.HasIndex("PropertyTypeId");
160
+
161
+                    b.HasIndex("ProvinceId");
162
+
163
+                    b.HasIndex("SuburbId");
164
+
165
+                    b.ToTable("Properties");
166
+                });
167
+
168
+            modelBuilder.Entity("UnivateProperties_API.Model.Property.PropertyImage", b =>
169
+                {
170
+                    b.Property<int>("Id")
171
+                        .ValueGeneratedOnAdd();
172
+
173
+                    b.Property<DateTime>("Created");
174
+
175
+                    b.Property<string>("Image");
176
+
177
+                    b.Property<bool>("IsDefault");
178
+
179
+                    b.Property<DateTime>("Modified");
180
+
181
+                    b.Property<string>("ModifiedBy");
182
+
183
+                    b.Property<int>("PropertyId");
184
+
185
+                    b.HasKey("Id");
186
+
187
+                    b.HasIndex("PropertyId");
188
+
189
+                    b.ToTable("PropertyImages");
190
+                });
191
+
192
+            modelBuilder.Entity("UnivateProperties_API.Model.Property.PropertyType", b =>
193
+                {
194
+                    b.Property<int>("Id")
195
+                        .ValueGeneratedOnAdd();
196
+
197
+                    b.Property<DateTime>("Created");
198
+
199
+                    b.Property<string>("Description");
200
+
201
+                    b.Property<DateTime>("Modified");
202
+
203
+                    b.Property<string>("ModifiedBy");
204
+
205
+                    b.Property<int>("UsageType");
206
+
207
+                    b.HasKey("Id");
208
+
209
+                    b.ToTable("PropertyTypes");
210
+                });
211
+
212
+            modelBuilder.Entity("UnivateProperties_API.Model.Property.PropertyUserField", b =>
213
+                {
214
+                    b.Property<int>("Id")
215
+                        .ValueGeneratedOnAdd();
216
+
217
+                    b.Property<DateTime>("Created");
218
+
219
+                    b.Property<string>("Description");
220
+
221
+                    b.Property<DateTime>("Modified");
222
+
223
+                    b.Property<string>("ModifiedBy");
224
+
225
+                    b.Property<int>("PropertyId");
226
+
227
+                    b.Property<int>("UserDefinedFieldId");
228
+
229
+                    b.Property<string>("Value");
230
+
231
+                    b.HasKey("Id");
232
+
233
+                    b.HasIndex("PropertyId");
234
+
235
+                    b.HasIndex("UserDefinedFieldId");
236
+
237
+                    b.ToTable("PropertyUserFields");
238
+                });
239
+
240
+            modelBuilder.Entity("UnivateProperties_API.Model.Property.UserDefinedField", b =>
241
+                {
242
+                    b.Property<int>("Id")
243
+                        .ValueGeneratedOnAdd();
244
+
245
+                    b.Property<DateTime>("Created");
246
+
247
+                    b.Property<string>("FieldName");
248
+
249
+                    b.Property<string>("FieldType");
250
+
251
+                    b.Property<int>("GroupId");
252
+
253
+                    b.Property<DateTime>("Modified");
254
+
255
+                    b.Property<string>("ModifiedBy");
256
+
257
+                    b.Property<int>("Rank");
258
+
259
+                    b.HasKey("Id");
260
+
261
+                    b.HasIndex("GroupId");
262
+
263
+                    b.ToTable("UserDefinedFields");
264
+                });
265
+
266
+            modelBuilder.Entity("UnivateProperties_API.Model.Property.UserDefinedGroup", b =>
267
+                {
268
+                    b.Property<int>("Id")
269
+                        .ValueGeneratedOnAdd();
270
+
271
+                    b.Property<DateTime>("Created");
272
+
273
+                    b.Property<string>("Description");
274
+
275
+                    b.Property<DateTime>("Modified");
276
+
277
+                    b.Property<string>("ModifiedBy");
278
+
279
+                    b.Property<int>("Rank");
280
+
281
+                    b.Property<int>("UsageType");
282
+
283
+                    b.HasKey("Id");
284
+
285
+                    b.ToTable("UserDefinedGroups");
286
+                });
287
+
288
+            modelBuilder.Entity("UnivateProperties_API.Model.Region.City", b =>
289
+                {
290
+                    b.Property<int>("Id")
291
+                        .ValueGeneratedOnAdd();
292
+
293
+                    b.Property<string>("Code");
294
+
295
+                    b.Property<DateTime>("Created");
296
+
297
+                    b.Property<string>("Description");
298
+
299
+                    b.Property<DateTime>("Modified");
300
+
301
+                    b.Property<string>("ModifiedBy");
302
+
303
+                    b.Property<int>("ProvinceId");
304
+
305
+                    b.HasKey("Id");
306
+
307
+                    b.HasIndex("ProvinceId");
308
+
309
+                    b.ToTable("Cities");
310
+                });
311
+
312
+            modelBuilder.Entity("UnivateProperties_API.Model.Region.Province", b =>
313
+                {
314
+                    b.Property<int>("Id")
315
+                        .ValueGeneratedOnAdd();
316
+
317
+                    b.Property<string>("Code");
318
+
319
+                    b.Property<DateTime>("Created");
320
+
321
+                    b.Property<string>("Description");
322
+
323
+                    b.Property<DateTime>("Modified");
324
+
325
+                    b.Property<string>("ModifiedBy");
326
+
327
+                    b.HasKey("Id");
328
+
329
+                    b.ToTable("Provinces");
330
+                });
331
+
332
+            modelBuilder.Entity("UnivateProperties_API.Model.Region.Suburb", b =>
333
+                {
334
+                    b.Property<int>("Id")
335
+                        .ValueGeneratedOnAdd();
336
+
337
+                    b.Property<int>("CityId");
338
+
339
+                    b.Property<DateTime>("Created");
340
+
341
+                    b.Property<string>("Description");
342
+
343
+                    b.Property<DateTime>("Modified");
344
+
345
+                    b.Property<string>("ModifiedBy");
346
+
347
+                    b.Property<string>("PostalCode");
348
+
349
+                    b.HasKey("Id");
350
+
351
+                    b.HasIndex("CityId");
352
+
353
+                    b.ToTable("Suburbs");
354
+                });
355
+
356
+            modelBuilder.Entity("UnivateProperties_API.Model.Timeshare.Season", b =>
357
+                {
358
+                    b.Property<int>("Id")
359
+                        .ValueGeneratedOnAdd();
360
+
361
+                    b.Property<DateTime>("Created");
362
+
363
+                    b.Property<DateTime>("Modified");
364
+
365
+                    b.Property<string>("ModifiedBy");
366
+
367
+                    b.Property<string>("Name");
368
+
369
+                    b.HasKey("Id");
370
+
371
+                    b.ToTable("Seasons");
372
+                });
373
+
374
+            modelBuilder.Entity("UnivateProperties_API.Model.Timeshare.Status", b =>
375
+                {
376
+                    b.Property<int>("Id")
377
+                        .ValueGeneratedOnAdd();
378
+
379
+                    b.Property<string>("Code");
380
+
381
+                    b.Property<DateTime>("Created");
382
+
383
+                    b.Property<string>("Description");
384
+
385
+                    b.Property<DateTime>("Modified");
386
+
387
+                    b.Property<string>("ModifiedBy");
388
+
389
+                    b.Property<int>("StatusType");
390
+
391
+                    b.HasKey("Id");
392
+
393
+                    b.ToTable("Status");
394
+                });
395
+
396
+            modelBuilder.Entity("UnivateProperties_API.Model.Timeshare.TimeshareWeek", b =>
397
+                {
398
+                    b.Property<int>("Id")
399
+                        .ValueGeneratedOnAdd();
400
+
401
+                    b.Property<int?>("AgencyId");
402
+
403
+                    b.Property<bool>("AgentAsRep");
404
+
405
+                    b.Property<int?>("AgentId");
406
+
407
+                    b.Property<DateTime>("ArrivalDate");
408
+
409
+                    b.Property<string>("BankedWith");
410
+
411
+                    b.Property<int>("Bedrooms");
412
+
413
+                    b.Property<DateTime>("Created");
414
+
415
+                    b.Property<bool>("CurrentYearBanked");
416
+
417
+                    b.Property<DateTime>("DepartureDate");
418
+
419
+                    b.Property<bool>("LeviesPaidInFull");
420
+
421
+                    b.Property<double>("LevyAmount");
422
+
423
+                    b.Property<int>("MaxSleep");
424
+
425
+                    b.Property<DateTime>("Modified");
426
+
427
+                    b.Property<string>("ModifiedBy");
428
+
429
+                    b.Property<string>("Module");
430
+
431
+                    b.Property<DateTime>("OriginalPurchaseDate");
432
+
433
+                    b.Property<double>("OriginalPurchasePrice");
434
+
435
+                    b.Property<bool>("OtherResort");
436
+
437
+                    b.Property<int>("OwnerId");
438
+
439
+                    b.Property<bool>("ReferedByAgent");
440
+
441
+                    b.Property<int>("RegionId");
442
+
443
+                    b.Property<string>("ResortCode");
444
+
445
+                    b.Property<string>("ResortName");
446
+
447
+                    b.Property<string>("Season");
448
+
449
+                    b.Property<double>("SellPrice");
450
+
451
+                    b.Property<int>("StatusId");
452
+
453
+                    b.Property<string>("WeekNumber");
454
+
455
+                    b.Property<bool>("WeekPlacedForRental");
456
+
457
+                    b.HasKey("Id");
458
+
459
+                    b.HasIndex("AgencyId");
460
+
461
+                    b.HasIndex("AgentId");
462
+
463
+                    b.HasIndex("OwnerId");
464
+
465
+                    b.HasIndex("RegionId");
466
+
467
+                    b.HasIndex("StatusId");
468
+
469
+                    b.ToTable("Weeks");
470
+                });
471
+
472
+            modelBuilder.Entity("UnivateProperties_API.Model.Timeshare.UnitConfiguration", b =>
473
+                {
474
+                    b.Property<int>("Id")
475
+                        .ValueGeneratedOnAdd();
476
+
477
+                    b.Property<int>("Adults");
478
+
479
+                    b.Property<int>("Bedrooms");
480
+
481
+                    b.Property<int>("Children");
482
+
483
+                    b.Property<string>("Code");
484
+
485
+                    b.Property<DateTime>("Created");
486
+
487
+                    b.Property<DateTime>("Modified");
488
+
489
+                    b.Property<string>("ModifiedBy");
490
+
491
+                    b.HasKey("Id");
492
+
493
+                    b.HasIndex("Code")
494
+                        .IsUnique();
495
+
496
+                    b.ToTable("UnitConfigurations");
497
+                });
498
+
499
+            modelBuilder.Entity("UnivateProperties_API.Model.Timeshare.UnitConfigurationType", b =>
500
+                {
501
+                    b.Property<int>("Id")
502
+                        .ValueGeneratedOnAdd();
503
+
504
+                    b.Property<DateTime>("Created");
505
+
506
+                    b.Property<string>("Description");
507
+
508
+                    b.Property<DateTime>("Modified");
509
+
510
+                    b.Property<string>("ModifiedBy");
511
+
512
+                    b.Property<int>("UnitConfigurationId");
513
+
514
+                    b.HasKey("Id");
515
+
516
+                    b.HasIndex("UnitConfigurationId");
517
+
518
+                    b.ToTable("UnitConfigurationTypes");
519
+                });
520
+
521
+            modelBuilder.Entity("UnivateProperties_API.Model.Users.Agency", b =>
522
+                {
523
+                    b.Property<int>("Id")
524
+                        .ValueGeneratedOnAdd();
525
+
526
+                    b.Property<string>("AgencyName");
527
+
528
+                    b.Property<string>("CompanyRegNumber");
529
+
530
+                    b.Property<DateTime>("Created");
531
+
532
+                    b.Property<string>("EAABEFFCNumber");
533
+
534
+                    b.Property<DateTime>("Modified");
535
+
536
+                    b.Property<string>("ModifiedBy");
537
+
538
+                    b.HasKey("Id");
539
+
540
+                    b.ToTable("Agencies");
541
+                });
542
+
543
+            modelBuilder.Entity("UnivateProperties_API.Model.Users.Agent", b =>
544
+                {
545
+                    b.Property<int>("Id")
546
+                        .ValueGeneratedOnAdd();
547
+
548
+                    b.Property<int?>("AgencyId");
549
+
550
+                    b.Property<string>("CellNumber");
551
+
552
+                    b.Property<DateTime>("Created");
553
+
554
+                    b.Property<string>("Email");
555
+
556
+                    b.Property<DateTime>("Modified");
557
+
558
+                    b.Property<string>("ModifiedBy");
559
+
560
+                    b.Property<string>("Name");
561
+
562
+                    b.Property<string>("Surname");
563
+
564
+                    b.Property<string>("Telephone");
565
+
566
+                    b.Property<int>("UserId");
567
+
568
+                    b.HasKey("Id");
569
+
570
+                    b.HasIndex("AgencyId");
571
+
572
+                    b.HasIndex("UserId");
573
+
574
+                    b.ToTable("Agents");
575
+                });
576
+
577
+            modelBuilder.Entity("UnivateProperties_API.Model.Users.Individual", b =>
578
+                {
579
+                    b.Property<int>("Id")
580
+                        .ValueGeneratedOnAdd();
581
+
582
+                    b.Property<string>("CellNumber");
583
+
584
+                    b.Property<DateTime>("Created");
585
+
586
+                    b.Property<string>("Email");
587
+
588
+                    b.Property<DateTime>("Modified");
589
+
590
+                    b.Property<string>("ModifiedBy");
591
+
592
+                    b.Property<string>("Name");
593
+
594
+                    b.Property<string>("Surname");
595
+
596
+                    b.Property<string>("Telephone");
597
+
598
+                    b.Property<int>("UserId");
599
+
600
+                    b.HasKey("Id");
601
+
602
+                    b.HasIndex("UserId");
603
+
604
+                    b.ToTable("Individuals");
605
+                });
606
+
607
+            modelBuilder.Entity("UnivateProperties_API.Model.Users.User", b =>
608
+                {
609
+                    b.Property<int>("Id")
610
+                        .ValueGeneratedOnAdd();
611
+
612
+                    b.Property<DateTime>("Created");
613
+
614
+                    b.Property<DateTime>("Modified");
615
+
616
+                    b.Property<string>("ModifiedBy");
617
+
618
+                    b.Property<byte[]>("PasswordHash");
619
+
620
+                    b.Property<byte[]>("PasswordSalt");
621
+
622
+                    b.Property<string>("Role");
623
+
624
+                    b.Property<string>("Token");
625
+
626
+                    b.Property<string>("Username");
627
+
628
+                    b.Property<bool>("Verified");
629
+
630
+                    b.HasKey("Id");
631
+
632
+                    b.ToTable("Users");
633
+                });
634
+
635
+            modelBuilder.Entity("UnivateProperties_API.Model.Communication.Email", b =>
636
+                {
637
+                    b.HasOne("UnivateProperties_API.Model.Communication.SMTPAccount", "Sender")
638
+                        .WithMany("Emails")
639
+                        .HasForeignKey("SenderId")
640
+                        .OnDelete(DeleteBehavior.Cascade);
641
+                });
642
+
643
+            modelBuilder.Entity("UnivateProperties_API.Model.Communication.SMTPAccount", b =>
644
+                {
645
+                    b.HasOne("UnivateProperties_API.Model.Communication.SMTPHost", "SMTPHost")
646
+                        .WithMany("SMTPAccounts")
647
+                        .HasForeignKey("SMTPHostId")
648
+                        .OnDelete(DeleteBehavior.Cascade);
649
+                });
650
+
651
+            modelBuilder.Entity("UnivateProperties_API.Model.Property.Property", b =>
652
+                {
653
+                    b.HasOne("UnivateProperties_API.Model.Region.City", "City")
654
+                        .WithMany()
655
+                        .HasForeignKey("CityId")
656
+                        .OnDelete(DeleteBehavior.Cascade);
657
+
658
+                    b.HasOne("UnivateProperties_API.Model.Property.PropertyType", "PropertyType")
659
+                        .WithMany()
660
+                        .HasForeignKey("PropertyTypeId")
661
+                        .OnDelete(DeleteBehavior.Cascade);
662
+
663
+                    b.HasOne("UnivateProperties_API.Model.Region.Province", "Province")
664
+                        .WithMany()
665
+                        .HasForeignKey("ProvinceId")
666
+                        .OnDelete(DeleteBehavior.Cascade);
667
+
668
+                    b.HasOne("UnivateProperties_API.Model.Region.Suburb", "Suburb")
669
+                        .WithMany()
670
+                        .HasForeignKey("SuburbId")
671
+                        .OnDelete(DeleteBehavior.Cascade);
672
+                });
673
+
674
+            modelBuilder.Entity("UnivateProperties_API.Model.Property.PropertyImage", b =>
675
+                {
676
+                    b.HasOne("UnivateProperties_API.Model.Property.Property", "Property")
677
+                        .WithMany("PropertyImages")
678
+                        .HasForeignKey("PropertyId")
679
+                        .OnDelete(DeleteBehavior.Cascade);
680
+                });
681
+
682
+            modelBuilder.Entity("UnivateProperties_API.Model.Property.PropertyUserField", b =>
683
+                {
684
+                    b.HasOne("UnivateProperties_API.Model.Property.Property", "Property")
685
+                        .WithMany("PropertyUserFields")
686
+                        .HasForeignKey("PropertyId")
687
+                        .OnDelete(DeleteBehavior.Cascade);
688
+
689
+                    b.HasOne("UnivateProperties_API.Model.Property.UserDefinedField", "UserDefinedField")
690
+                        .WithMany()
691
+                        .HasForeignKey("UserDefinedFieldId")
692
+                        .OnDelete(DeleteBehavior.Cascade);
693
+                });
694
+
695
+            modelBuilder.Entity("UnivateProperties_API.Model.Property.UserDefinedField", b =>
696
+                {
697
+                    b.HasOne("UnivateProperties_API.Model.Property.UserDefinedGroup", "Group")
698
+                        .WithMany("Fields")
699
+                        .HasForeignKey("GroupId")
700
+                        .OnDelete(DeleteBehavior.Cascade);
701
+                });
702
+
703
+            modelBuilder.Entity("UnivateProperties_API.Model.Region.City", b =>
704
+                {
705
+                    b.HasOne("UnivateProperties_API.Model.Region.Province", "Province")
706
+                        .WithMany()
707
+                        .HasForeignKey("ProvinceId")
708
+                        .OnDelete(DeleteBehavior.Cascade);
709
+                });
710
+
711
+            modelBuilder.Entity("UnivateProperties_API.Model.Region.Suburb", b =>
712
+                {
713
+                    b.HasOne("UnivateProperties_API.Model.Region.City", "City")
714
+                        .WithMany()
715
+                        .HasForeignKey("CityId")
716
+                        .OnDelete(DeleteBehavior.Cascade);
717
+                });
718
+
719
+            modelBuilder.Entity("UnivateProperties_API.Model.Timeshare.TimeshareWeek", b =>
720
+                {
721
+                    b.HasOne("UnivateProperties_API.Model.Users.Agency", "Agency")
722
+                        .WithMany()
723
+                        .HasForeignKey("AgencyId");
724
+
725
+                    b.HasOne("UnivateProperties_API.Model.Users.Agent", "Agent")
726
+                        .WithMany()
727
+                        .HasForeignKey("AgentId");
728
+
729
+                    b.HasOne("UnivateProperties_API.Model.Users.Individual", "Owner")
730
+                        .WithMany()
731
+                        .HasForeignKey("OwnerId")
732
+                        .OnDelete(DeleteBehavior.Cascade);
733
+
734
+                    b.HasOne("UnivateProperties_API.Model.Region.Province", "Region")
735
+                        .WithMany()
736
+                        .HasForeignKey("RegionId")
737
+                        .OnDelete(DeleteBehavior.Cascade);
738
+
739
+                    b.HasOne("UnivateProperties_API.Model.Timeshare.Status", "Status")
740
+                        .WithMany()
741
+                        .HasForeignKey("StatusId")
742
+                        .OnDelete(DeleteBehavior.Cascade);
743
+                });
744
+
745
+            modelBuilder.Entity("UnivateProperties_API.Model.Timeshare.UnitConfigurationType", b =>
746
+                {
747
+                    b.HasOne("UnivateProperties_API.Model.Timeshare.UnitConfiguration", "UnitConfiguration")
748
+                        .WithMany("Types")
749
+                        .HasForeignKey("UnitConfigurationId")
750
+                        .OnDelete(DeleteBehavior.Cascade);
751
+                });
752
+
753
+            modelBuilder.Entity("UnivateProperties_API.Model.Users.Agent", b =>
754
+                {
755
+                    b.HasOne("UnivateProperties_API.Model.Users.Agency", "Agency")
756
+                        .WithMany("Agents")
757
+                        .HasForeignKey("AgencyId");
758
+
759
+                    b.HasOne("UnivateProperties_API.Model.Users.User", "User")
760
+                        .WithMany()
761
+                        .HasForeignKey("UserId")
762
+                        .OnDelete(DeleteBehavior.Cascade);
763
+                });
764
+
765
+            modelBuilder.Entity("UnivateProperties_API.Model.Users.Individual", b =>
766
+                {
767
+                    b.HasOne("UnivateProperties_API.Model.Users.User", "User")
768
+                        .WithMany()
769
+                        .HasForeignKey("UserId")
770
+                        .OnDelete(DeleteBehavior.Cascade);
771
+                });
772
+#pragma warning restore 612, 618
773
+        }
774
+    }
775
+}

+ 23
- 0
UnivateProperties_API/Migrations/20190905084739_AddedSellPrice.cs Dosyayı Görüntüle

@@ -0,0 +1,23 @@
1
+using Microsoft.EntityFrameworkCore.Migrations;
2
+
3
+namespace UnivateProperties_API.Migrations
4
+{
5
+    public partial class AddedSellPrice : Migration
6
+    {
7
+        protected override void Up(MigrationBuilder migrationBuilder)
8
+        {
9
+            migrationBuilder.AddColumn<double>(
10
+                name: "SellPrice",
11
+                table: "Weeks",
12
+                nullable: false,
13
+                defaultValue: 0.0);
14
+        }
15
+
16
+        protected override void Down(MigrationBuilder migrationBuilder)
17
+        {
18
+            migrationBuilder.DropColumn(
19
+                name: "SellPrice",
20
+                table: "Weeks");
21
+        }
22
+    }
23
+}

+ 5
- 5
UnivateProperties_API/Migrations/DataContextModelSnapshot.cs Dosyayı Görüntüle

@@ -398,6 +398,8 @@ namespace UnivateProperties_API.Migrations
398 398
 
399 399
                     b.Property<int?>("AgencyId");
400 400
 
401
+                    b.Property<bool>("AgentAsRep");
402
+
401 403
                     b.Property<int?>("AgentId");
402 404
 
403 405
                     b.Property<DateTime>("ArrivalDate");
@@ -442,6 +444,8 @@ namespace UnivateProperties_API.Migrations
442 444
 
443 445
                     b.Property<string>("Season");
444 446
 
447
+                    b.Property<double>("SellPrice");
448
+
445 449
                     b.Property<int>("StatusId");
446 450
 
447 451
                     b.Property<string>("WeekNumber");
@@ -609,16 +613,12 @@ namespace UnivateProperties_API.Migrations
609 613
 
610 614
                     b.Property<string>("ModifiedBy");
611 615
 
612
-                    b.Property<string>("Name");
613
-
614 616
                     b.Property<byte[]>("PasswordHash");
615 617
 
616 618
                     b.Property<byte[]>("PasswordSalt");
617 619
 
618 620
                     b.Property<string>("Role");
619 621
 
620
-                    b.Property<string>("Surname");
621
-
622 622
                     b.Property<string>("Token");
623 623
 
624 624
                     b.Property<string>("Username");
@@ -724,7 +724,7 @@ namespace UnivateProperties_API.Migrations
724 724
                         .WithMany()
725 725
                         .HasForeignKey("AgentId");
726 726
 
727
-                    b.HasOne("UnivateProperties_API.Model.Users.User", "Owner")
727
+                    b.HasOne("UnivateProperties_API.Model.Users.Individual", "Owner")
728 728
                         .WithMany()
729 729
                         .HasForeignKey("OwnerId")
730 730
                         .OnDelete(DeleteBehavior.Cascade);

+ 8
- 0
UnivateProperties_API/Model/Bank/Bank.cs Dosyayı Görüntüle

@@ -0,0 +1,8 @@
1
+namespace UnivateProperties_API.Model.Bank
2
+{
3
+    public class Bank : BaseEntity
4
+    {
5
+        public string Name { get; set; }
6
+        public string UniversalBranchCode { get; set; }
7
+    }
8
+}

+ 19
- 0
UnivateProperties_API/Model/Bank/BankAccount.cs Dosyayı Görüntüle

@@ -0,0 +1,19 @@
1
+using UnivateProperties_API.Model.Users;
2
+
3
+namespace UnivateProperties_API.Model.Bank
4
+{
5
+    public class BankAccount : BaseEntity
6
+    {
7
+        #region Properties
8
+        public string AccountHolder { get; set; }
9
+        public string AccountNumber { get; set; }
10
+        public int BankId { get; set; }
11
+        public int? OwnerId { get; set; }
12
+        #endregion Properties
13
+
14
+        #region Navigation
15
+        public virtual Bank Bank { get; set; }
16
+        public virtual Individual Owner { get; set; } 
17
+        #endregion
18
+    }
19
+}

+ 4
- 1
UnivateProperties_API/Model/Timeshare/TimeshareWeek.cs Dosyayı Görüntüle

@@ -16,6 +16,7 @@ namespace UnivateProperties_API.Model.Timeshare
16 16
         [ForeignKey("Owner")]
17 17
         public int OwnerId { get; set; }
18 18
 
19
+        public bool AgentAsRep { get; set; }
19 20
         public bool OtherResort { get; set; }
20 21
         public string ResortCode { get; set; }
21 22
         public string ResortName { get; set; }
@@ -37,6 +38,8 @@ namespace UnivateProperties_API.Model.Timeshare
37 38
         public DateTime OriginalPurchaseDate { get; set; }
38 39
         public DateTime ArrivalDate { get; set; }
39 40
         public DateTime DepartureDate { get; set; }
41
+        
42
+        public double SellPrice { get; set; }
40 43
 
41 44
         [ForeignKey("Status")]
42 45
         public int StatusId { get; set; }
@@ -45,7 +48,7 @@ namespace UnivateProperties_API.Model.Timeshare
45 48
         #region Navigation
46 49
         public virtual Status Status { get; set; }
47 50
         public virtual Province Region { get; set; }
48
-        public virtual User Owner { get; set; }
51
+        public virtual Individual Owner { get; set; }
49 52
         public virtual Agent Agent { get; set; }
50 53
         public virtual Agency Agency { get; set; }
51 54
         #endregion Navigation

+ 1
- 3
UnivateProperties_API/Model/Users/Person.cs Dosyayı Görüntüle

@@ -1,7 +1,5 @@
1
-using System.Collections.Generic;
2
-using System.ComponentModel.DataAnnotations;
1
+using System.ComponentModel.DataAnnotations;
3 2
 using System.ComponentModel.DataAnnotations.Schema;
4
-using UnivateProperties_API.Model.Timeshare;
5 3
 
6 4
 namespace UnivateProperties_API.Model.Users
7 5
 {

+ 40
- 1
UnivateProperties_API/Repository/Timeshare/WeekRepository.cs Dosyayı Görüntüle

@@ -2,6 +2,7 @@
2 2
 using System;
3 3
 using System.Collections.Generic;
4 4
 using System.Linq;
5
+using UnivateProperties_API.Containers.Timeshare;
5 6
 using UnivateProperties_API.Context;
6 7
 using UnivateProperties_API.Model.Timeshare;
7 8
 using UnivateProperties_API.Repository.Region;
@@ -82,7 +83,17 @@ namespace UnivateProperties_API.Repository.Timeshare
82 83
             // Set starting Status of A1
83 84
             StatusRepository repo = new StatusRepository(_dbContext);
84 85
             item.Status = repo.GetDetailed(s => s.Code == "A1");
85
-            item.StatusId = item.Status.Id;
86
+            if(item.Status != null)
87
+            {
88
+                //Create initial
89
+                item.Status = new Status()
90
+                {
91
+                    Code = "A1",
92
+                    Description = "Pending verification",
93
+                    StatusType = StatusType.Timeshare,
94
+                    ModifiedBy = "KobusB"
95
+                };
96
+            }            
86 97
             _dbContext.Add(item);
87 98
             Save();
88 99
         }
@@ -130,5 +141,33 @@ namespace UnivateProperties_API.Repository.Timeshare
130 141
             _dbContext.Entry(item).State = EntityState.Modified;
131 142
             Save();
132 143
         }
144
+
145
+        public List<TimeshareWeek> GetBy(WeekFilterDto week)
146
+        {
147
+            List<TimeshareWeek> item = GetDetailedAll();
148
+            if (!string.IsNullOrEmpty(week.RegionCode))
149
+            {
150
+                item = item.Where(x => x.Region != null && x.Region.Code?.ToLower() == week.RegionCode.ToLower()).ToList();
151
+            }
152
+            if (!string.IsNullOrEmpty(week.ResortCode))
153
+            {
154
+                item = item.Where(x => x.ResortCode?.ToLower() == week.ResortCode).ToList();
155
+            }
156
+            if (week.Date != null)
157
+            {
158
+                item = item.Where(x =>
159
+                                        x.ArrivalDate >= week.Date.Value.AddDays(-7)
160
+                                        && x.DepartureDate <= week.Date.Value.AddDays(7)).ToList();
161
+            }
162
+            if (week.MinAmount != null && week.MinAmount != 0)
163
+            {
164
+                item = item.Where(x => x.SellPrice >= week.MinAmount).ToList();
165
+            }
166
+            if (week.MaxAmount != null && week.MaxAmount != 0)
167
+            {
168
+                item.Where(x => x.SellPrice <= week.MaxAmount).ToList();
169
+            }
170
+            return item;
171
+        }
133 172
     }
134 173
 }

+ 14
- 0
UnivateProperties_API/Startup.cs Dosyayı Görüntüle

@@ -131,6 +131,7 @@ namespace UnivateProperties_API
131 131
 
132 132
         public void Configure(IApplicationBuilder app, IHostingEnvironment env)
133 133
         {
134
+            UpdateDatabase(app);
134 135
             if (env.IsDevelopment())
135 136
             {
136 137
                 app.UseDeveloperExceptionPage();
@@ -143,5 +144,18 @@ namespace UnivateProperties_API
143 144
             app.UseHttpsRedirection();
144 145
             app.UseMvc();
145 146
         }
147
+
148
+        private static void UpdateDatabase(IApplicationBuilder app)
149
+        {
150
+            using (var serviceScope = app.ApplicationServices
151
+                .GetRequiredService<IServiceScopeFactory>()
152
+                .CreateScope())
153
+            {
154
+                using (var context = serviceScope.ServiceProvider.GetService<DataContext>())
155
+                {
156
+                    context.Database.Migrate();
157
+                }
158
+            }
159
+        }
146 160
     }
147 161
 }

+ 0
- 7
UnivateProperties_API/UnivateProperties_API.csproj Dosyayı Görüntüle

@@ -5,13 +5,6 @@
5 5
     <AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
6 6
   </PropertyGroup>
7 7
 
8
-  <ItemGroup>
9
-    <Compile Remove="Migrations\**" />
10
-    <Content Remove="Migrations\**" />
11
-    <EmbeddedResource Remove="Migrations\**" />
12
-    <None Remove="Migrations\**" />
13
-  </ItemGroup>
14
-
15 8
   <ItemGroup>
16 9
     <Compile Remove="Model\Users\AgencyAgent.cs" />
17 10
   </ItemGroup>

+ 1
- 1
UnivateProperties_API/appsettings.json Dosyayı Görüntüle

@@ -9,6 +9,6 @@
9 9
   },
10 10
   "AllowedHosts": "*",
11 11
   "ConnectionStrings": {
12
-    "DefaultConnection": "Server=localhost;Port=5432;Database=Univate;User Id=postgres;Password=Prov1s1on;"
12
+    "DefaultConnection": "Server=192.168.6.188;Port=5432;Database=Univate;User Id=postgres;Password=prov1s1on;"
13 13
   }
14 14
 }

Loading…
İptal
Kaydet