Ver código fonte

Added bid

master
Kobus 5 anos atrás
pai
commit
c4fe9825bb

+ 5
- 1
UnivateProperties_API/Context/DataContext.cs Ver arquivo

@@ -56,9 +56,13 @@ namespace UnivateProperties_API.Context
56 56
         public DbSet<Season> Seasons { get; set; }
57 57
         public DbSet<Bank> Banks { get; set; }
58 58
         public DbSet<BankAccount> BankAccounts { get; set; }
59
-        public DbSet<ProcessFlow> ProcessFlows { get; set; }
60 59
         #endregion Timeshare
61 60
 
61
+        #region ProcessFlow
62
+        public DbSet<ProcessFlow> ProcessFlows { get; set; }
63
+        public DbSet<BidItem> BidItems { get; set; }
64
+        #endregion
65
+
62 66
         public override int SaveChanges()
63 67
         {
64 68
             foreach(var item in ChangeTracker

+ 1008
- 0
UnivateProperties_API/Migrations/20190906105051_Process.Designer.cs
Diferenças do arquivo suprimidas por serem muito extensas
Ver arquivo


+ 84
- 0
UnivateProperties_API/Migrations/20190906105051_Process.cs Ver arquivo

@@ -0,0 +1,84 @@
1
+using System;
2
+using Microsoft.EntityFrameworkCore.Migrations;
3
+using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
4
+
5
+namespace UnivateProperties_API.Migrations
6
+{
7
+    public partial class Process : Migration
8
+    {
9
+        protected override void Up(MigrationBuilder migrationBuilder)
10
+        {
11
+            migrationBuilder.CreateTable(
12
+                name: "BidItems",
13
+                columns: table => new
14
+                {
15
+                    Id = table.Column<int>(nullable: false)
16
+                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
17
+                    Created = table.Column<DateTime>(nullable: false),
18
+                    Modified = table.Column<DateTime>(nullable: false),
19
+                    ModifiedBy = table.Column<string>(nullable: true),
20
+                    Amount = table.Column<double>(nullable: false),
21
+                    StatusId = table.Column<int>(nullable: true),
22
+                    BidMakerId = table.Column<int>(nullable: true),
23
+                    TimeshareWeekId = table.Column<int>(nullable: true),
24
+                    PropertyId = table.Column<int>(nullable: true),
25
+                    Comment = table.Column<string>(nullable: true),
26
+                    DeclinedReason = table.Column<string>(nullable: true)
27
+                },
28
+                constraints: table =>
29
+                {
30
+                    table.PrimaryKey("PK_BidItems", x => x.Id);
31
+                    table.ForeignKey(
32
+                        name: "FK_BidItems_Individuals_BidMakerId",
33
+                        column: x => x.BidMakerId,
34
+                        principalTable: "Individuals",
35
+                        principalColumn: "Id",
36
+                        onDelete: ReferentialAction.Restrict);
37
+                    table.ForeignKey(
38
+                        name: "FK_BidItems_Properties_PropertyId",
39
+                        column: x => x.PropertyId,
40
+                        principalTable: "Properties",
41
+                        principalColumn: "Id",
42
+                        onDelete: ReferentialAction.Restrict);
43
+                    table.ForeignKey(
44
+                        name: "FK_BidItems_Status_StatusId",
45
+                        column: x => x.StatusId,
46
+                        principalTable: "Status",
47
+                        principalColumn: "Id",
48
+                        onDelete: ReferentialAction.Restrict);
49
+                    table.ForeignKey(
50
+                        name: "FK_BidItems_Weeks_TimeshareWeekId",
51
+                        column: x => x.TimeshareWeekId,
52
+                        principalTable: "Weeks",
53
+                        principalColumn: "Id",
54
+                        onDelete: ReferentialAction.Restrict);
55
+                });
56
+
57
+            migrationBuilder.CreateIndex(
58
+                name: "IX_BidItems_BidMakerId",
59
+                table: "BidItems",
60
+                column: "BidMakerId");
61
+
62
+            migrationBuilder.CreateIndex(
63
+                name: "IX_BidItems_PropertyId",
64
+                table: "BidItems",
65
+                column: "PropertyId");
66
+
67
+            migrationBuilder.CreateIndex(
68
+                name: "IX_BidItems_StatusId",
69
+                table: "BidItems",
70
+                column: "StatusId");
71
+
72
+            migrationBuilder.CreateIndex(
73
+                name: "IX_BidItems_TimeshareWeekId",
74
+                table: "BidItems",
75
+                column: "TimeshareWeekId");
76
+        }
77
+
78
+        protected override void Down(MigrationBuilder migrationBuilder)
79
+        {
80
+            migrationBuilder.DropTable(
81
+                name: "BidItems");
82
+        }
83
+    }
84
+}

+ 59
- 2
UnivateProperties_API/Migrations/DataContextModelSnapshot.cs Ver arquivo

@@ -179,6 +179,44 @@ namespace UnivateProperties_API.Migrations
179 179
                     b.ToTable("Addresses");
180 180
                 });
181 181
 
182
+            modelBuilder.Entity("UnivateProperties_API.Model.ProcessFlow.BidItem", b =>
183
+                {
184
+                    b.Property<int>("Id")
185
+                        .ValueGeneratedOnAdd();
186
+
187
+                    b.Property<double>("Amount");
188
+
189
+                    b.Property<int?>("BidMakerId");
190
+
191
+                    b.Property<string>("Comment");
192
+
193
+                    b.Property<DateTime>("Created");
194
+
195
+                    b.Property<string>("DeclinedReason");
196
+
197
+                    b.Property<DateTime>("Modified");
198
+
199
+                    b.Property<string>("ModifiedBy");
200
+
201
+                    b.Property<int?>("PropertyId");
202
+
203
+                    b.Property<int?>("StatusId");
204
+
205
+                    b.Property<int?>("TimeshareWeekId");
206
+
207
+                    b.HasKey("Id");
208
+
209
+                    b.HasIndex("BidMakerId");
210
+
211
+                    b.HasIndex("PropertyId");
212
+
213
+                    b.HasIndex("StatusId");
214
+
215
+                    b.HasIndex("TimeshareWeekId");
216
+
217
+                    b.ToTable("BidItems");
218
+                });
219
+
182 220
             modelBuilder.Entity("UnivateProperties_API.Model.ProcessFlow.ProcessFlow", b =>
183 221
                 {
184 222
                     b.Property<int>("Id")
@@ -788,10 +826,29 @@ namespace UnivateProperties_API.Migrations
788 826
                         .OnDelete(DeleteBehavior.Cascade);
789 827
                 });
790 828
 
791
-            modelBuilder.Entity("UnivateProperties_API.Model.ProcessFlow.ProcessFlow", b =>
829
+            modelBuilder.Entity("UnivateProperties_API.Model.ProcessFlow.BidItem", b =>
792 830
                 {
831
+                    b.HasOne("UnivateProperties_API.Model.Users.Individual", "BidMaker")
832
+                        .WithMany()
833
+                        .HasForeignKey("BidMakerId");
834
+
793 835
                     b.HasOne("UnivateProperties_API.Model.Properties.Property", "Property")
836
+                        .WithMany("BidItems")
837
+                        .HasForeignKey("PropertyId");
838
+
839
+                    b.HasOne("UnivateProperties_API.Model.Timeshare.Status", "Status")
794 840
                         .WithMany()
841
+                        .HasForeignKey("StatusId");
842
+
843
+                    b.HasOne("UnivateProperties_API.Model.Timeshare.TimeshareWeek", "TimeshareWeek")
844
+                        .WithMany("BidItems")
845
+                        .HasForeignKey("TimeshareWeekId");
846
+                });
847
+
848
+            modelBuilder.Entity("UnivateProperties_API.Model.ProcessFlow.ProcessFlow", b =>
849
+                {
850
+                    b.HasOne("UnivateProperties_API.Model.Properties.Property", "Property")
851
+                        .WithMany("ProcessFlows")
795 852
                         .HasForeignKey("PropertyID");
796 853
 
797 854
                     b.HasOne("UnivateProperties_API.Model.Timeshare.Status", "Status")
@@ -800,7 +857,7 @@ namespace UnivateProperties_API.Migrations
800 857
                         .OnDelete(DeleteBehavior.Cascade);
801 858
 
802 859
                     b.HasOne("UnivateProperties_API.Model.Timeshare.TimeshareWeek", "Timeshare")
803
-                        .WithMany()
860
+                        .WithMany("ProcessFlows")
804 861
                         .HasForeignKey("TimeshareID");
805 862
                 });
806 863
 

+ 24
- 0
UnivateProperties_API/Model/ProcessFlow/BidItem.cs Ver arquivo

@@ -0,0 +1,24 @@
1
+using UnivateProperties_API.Model.Properties;
2
+using UnivateProperties_API.Model.Timeshare;
3
+using UnivateProperties_API.Model.Users;
4
+
5
+namespace UnivateProperties_API.Model.ProcessFlow
6
+{
7
+    public class BidItem : BaseEntity
8
+    {
9
+        #region Properties
10
+        public double Amount { get; set; }
11
+        public int? StatusId { get; set; }
12
+        public int? BidMakerId { get; set; }
13
+        public int? TimeshareWeekId { get; set; }
14
+        public int? PropertyId { get; set; }
15
+        public string Comment { get; set; }
16
+        public string DeclinedReason { get; set; }
17
+
18
+        public virtual Status Status { get; set; }
19
+        public virtual Individual BidMaker { get; set; }
20
+        public virtual TimeshareWeek TimeshareWeek {get;set;}
21
+        public virtual Property Property { get; set; }
22
+        #endregion
23
+    }
24
+}

+ 3
- 0
UnivateProperties_API/Model/Properties/Property.cs Ver arquivo

@@ -1,6 +1,7 @@
1 1
 using System.Collections.Generic;
2 2
 using System.ComponentModel.DataAnnotations.Schema;
3 3
 using UnivateProperties_API.Containers.Property;
4
+using UnivateProperties_API.Model.ProcessFlow;
4 5
 using UnivateProperties_API.Model.Region;
5 6
 using UnivateProperties_API.Model.Timeshare;
6 7
 using UnivateProperties_API.Model.Users;
@@ -53,6 +54,8 @@ namespace UnivateProperties_API.Model.Properties
53 54
 
54 55
         public ICollection<PropertyUserField> PropertyUserFields { get; set; }
55 56
         public ICollection<PropertyImage> PropertyImages { get; set; }
57
+        public ICollection<BidItem> BidItems { get; set; }
58
+        public ICollection<ProcessFlow.ProcessFlow> ProcessFlows { get; set; }
56 59
 
57 60
         [NotMapped]
58 61
         public List<PropertyDetailGroup> DisplayData { get; set; }

+ 4
- 0
UnivateProperties_API/Model/Timeshare/TimeshareWeek.cs Ver arquivo

@@ -1,5 +1,7 @@
1 1
 using System;
2
+using System.Collections.Generic;
2 3
 using System.ComponentModel.DataAnnotations.Schema;
4
+using UnivateProperties_API.Model.ProcessFlow;
3 5
 using UnivateProperties_API.Model.Region;
4 6
 using UnivateProperties_API.Model.Users;
5 7
 
@@ -51,6 +53,8 @@ namespace UnivateProperties_API.Model.Timeshare
51 53
         public virtual Individual Owner { get; set; }
52 54
         public virtual Agent Agent { get; set; }
53 55
         public virtual Agency Agency { get; set; }
56
+        public virtual ICollection<BidItem> BidItems { get; set; }
57
+        public virtual ICollection<ProcessFlow.ProcessFlow> ProcessFlows { get; set; } 
54 58
         #endregion Navigation
55 59
     }
56 60
 }

+ 1
- 1
UnivateProperties_API/appsettings.json Ver arquivo

@@ -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
 }

Carregando…
Cancelar
Salvar