George Williams 5年前
コミット
5ce4c5d051

+ 12
- 0
UnivateProperties_API/Containers/Timeshare/Detailed/DetailedOwner.cs ファイルの表示

@@ -33,6 +33,18 @@ namespace UnivateProperties_API.Containers.Timeshare.Detailed
33 33
             else BankingDetails = new DetailedBankDetails();
34 34
         }
35 35
 
36
+        public DetailedOwner(Agent agent)
37
+        {
38
+            Id = agent.Id;
39
+            Name = agent.Name;
40
+            Surname = agent.Surname;
41
+            EmailAddress = agent.Email;
42
+            CellNumber = agent.CellNumber;
43
+            LandlineNumber = agent.Telephone;
44
+            Address = new DetailedAddress();
45
+            BankingDetails = new DetailedBankDetails();
46
+        }
47
+
36 48
         public int Id { get; set; }
37 49
         public string Name { get; set; }
38 50
         public string Surname { get; set; }

+ 14
- 14
UnivateProperties_API/Migrations/20191018124608_NewPropertyProperties.cs ファイルの表示

@@ -6,26 +6,26 @@ namespace UnivateProperties_API.Migrations
6 6
     {
7 7
         protected override void Up(MigrationBuilder migrationBuilder)
8 8
         {
9
-            migrationBuilder.AddColumn<string>(
10
-                name: "Video",
11
-                table: "Properties",
12
-                nullable: true);
9
+            //migrationBuilder.AddColumn<string>(
10
+            //    name: "Video",
11
+            //    table: "Properties",
12
+            //    nullable: true);
13 13
 
14
-            migrationBuilder.AddColumn<string>(
15
-                name: "VirtualTour",
16
-                table: "Properties",
17
-                nullable: true);
14
+            //migrationBuilder.AddColumn<string>(
15
+            //    name: "VirtualTour",
16
+            //    table: "Properties",
17
+            //    nullable: true);
18 18
         }
19 19
 
20 20
         protected override void Down(MigrationBuilder migrationBuilder)
21 21
         {
22
-            migrationBuilder.DropColumn(
23
-                name: "Video",
24
-                table: "Properties");
22
+            //migrationBuilder.DropColumn(
23
+            //    name: "Video",
24
+            //    table: "Properties");
25 25
 
26
-            migrationBuilder.DropColumn(
27
-                name: "VirtualTour",
28
-                table: "Properties");
26
+            //migrationBuilder.DropColumn(
27
+            //    name: "VirtualTour",
28
+            //    table: "Properties");
29 29
         }
30 30
     }
31 31
 }

+ 14
- 1
UnivateProperties_API/Repository/Users/IndividualRepository.cs ファイルの表示

@@ -48,7 +48,20 @@ namespace UnivateProperties_API.Repository.Users
48 48
 
49 49
         public DetailedOwner GetIndividual(int id)
50 50
         {
51
-            return new DetailedOwner(_dbContext.Individuals.FirstOrDefault(x => x.UserId == id));
51
+            var item = _dbContext.Individuals.FirstOrDefault(x => x.UserId == id);
52
+            if(item != null)
53
+            {
54
+                return new DetailedOwner(item);
55
+            }
56
+            else
57
+            {
58
+                var aItem = _dbContext.Agents.FirstOrDefault(x => x.UserId == id);
59
+                if(aItem != null)
60
+                {
61
+                    return new DetailedOwner(aItem);
62
+                }
63
+            }
64
+            return new DetailedOwner();
52 65
         }
53 66
 
54 67
         public void Insert(Individual item)

読み込み中…
キャンセル
保存