Sfoglia il codice sorgente

Added getNeedApproval

master
Kobus 5 anni fa
parent
commit
645f1f6eae

+ 5
- 5
UnivateProperties_API/Containers/Timeshare/Detailed/DetailedAddress.cs Vedi File

@@ -30,10 +30,10 @@ namespace UnivateProperties_API.Containers.Timeshare.Detailed
30 30
         }
31 31
 
32 32
         public int Id { get; set; }
33
-        public string StreetNumber { get; set; }
34
-        public string Street { get; set; }
35
-        public string Suburb { get; set; }
36
-        public string City { get; set; }
37
-        public string PostalCode { get; set; }
33
+        public string StreetNumber { get; set; } = "";
34
+        public string Street { get; set; } = "";
35
+        public string Suburb { get; set; } = "";
36
+        public string City { get; set; } = "";
37
+        public string PostalCode { get; set; } = "";
38 38
     }
39 39
 }

+ 2
- 2
UnivateProperties_API/Containers/Timeshare/Detailed/DetailedBankDetails.cs Vedi File

@@ -27,7 +27,7 @@ namespace UnivateProperties_API.Containers.Timeshare.Detailed
27 27
 
28 28
         public int Id { get; set; }
29 29
         public int? BankId { get; set; }
30
-        public string AccountHolder { get; set; }
31
-        public string AccountNumber { get; set; }
30
+        public string AccountHolder { get; set; } = "";
31
+        public string AccountNumber { get; set; } = "";
32 32
     }
33 33
 }

+ 4
- 3
UnivateProperties_API/Containers/Timeshare/Detailed/DetailedOwner.cs Vedi File

@@ -6,7 +6,8 @@ namespace UnivateProperties_API.Containers.Timeshare.Detailed
6 6
     {
7 7
         public DetailedOwner()
8 8
         {
9
-
9
+            BankingDetails = new DetailedBankDetails();
10
+            Address = new DetailedAddress();
10 11
         }
11 12
 
12 13
         public DetailedOwner(Individual individual)
@@ -22,12 +23,12 @@ namespace UnivateProperties_API.Containers.Timeshare.Detailed
22 23
             LandlineNumber = individual.Telephone;
23 24
             if (individual.Address != null)
24 25
             {
25
-                Address = new DetailedAddress(individual.Address);
26
+                Address = individual.Address != null ? new DetailedAddress(individual.Address) : new DetailedAddress();
26 27
             }
27 28
             else Address = new DetailedAddress();
28 29
             if (BankingDetails != null)
29 30
             {
30
-                BankingDetails = new DetailedBankDetails(individual.BankAccount);
31
+                BankingDetails = individual.BankAccount != null ? new DetailedBankDetails(individual.BankAccount) : new DetailedBankDetails();
31 32
             }
32 33
             else BankingDetails = new DetailedBankDetails();
33 34
         }

+ 2
- 2
UnivateProperties_API/Containers/Timeshare/Detailed/DetailedWeekDto.cs Vedi File

@@ -7,7 +7,7 @@ namespace UnivateProperties_API.Containers.Timeshare.Detailed
7 7
     {
8 8
         public DetailedWeekDto()
9 9
         {
10
-
10
+            Owner = new DetailedOwner();
11 11
         }
12 12
 
13 13
         public DetailedWeekDto(TimeshareWeek week)
@@ -41,7 +41,7 @@ namespace UnivateProperties_API.Containers.Timeshare.Detailed
41 41
             AgentCommission = week.AgentCommision;
42 42
             Mandate = week.Mandate;
43 43
             Status = week.Status.Display;
44
-            Owner = new DetailedOwner(week.Owner);
44
+            Owner = week.Owner != null ? new DetailedOwner(week.Owner) : new DetailedOwner();
45 45
         }
46 46
 
47 47
         public int Id { get; set; }

+ 11
- 0
UnivateProperties_API/Controllers/Timeshare/TimeshareWeekController.cs Vedi File

@@ -54,6 +54,17 @@ namespace UnivateProperties_API.Controllers.Timeshare
54 54
             else return new OkResult();
55 55
         }
56 56
 
57
+        [HttpGet("getNeedApproval")]
58
+        public IActionResult GetNeedApproval()
59
+        {
60
+            if (_Repo is WeekRepository)
61
+            {
62
+                var item = (_Repo as WeekRepository).GetNeedApproval();
63
+                return new OkObjectResult(item);
64
+            }
65
+            else return new OkResult();
66
+        }
67
+
57 68
         [HttpGet("getBy")]
58 69
         public IActionResult GetBy(WeekFilterDto week)
59 70
         {

+ 12
- 0
UnivateProperties_API/Repository/Timeshare/WeekRepository.cs Vedi File

@@ -377,5 +377,17 @@ namespace UnivateProperties_API.Repository.Timeshare
377 377
                     return value;
378 378
             }
379 379
         }
380
+
381
+        public List<DetailedWeekDto> GetNeedApproval()
382
+        {
383
+            List<DetailedWeekDto> detList = new List<DetailedWeekDto>();
384
+            var status = _dbContext.Status.FirstOrDefault(x => x.Code == "A1" && x.StatusType == StatusType.Timeshare);
385
+            if(status != null)
386
+            {
387
+                var list = GetDetailedAll().Where(x => x.Status != null && x.Status.Id == status.Id).ToList();
388
+                list.ForEach(x => detList.Add(new DetailedWeekDto(x)));
389
+            }
390
+            return detList;
391
+        }
380 392
     }
381 393
 }

Loading…
Annulla
Salva