diff --git a/git/JurasicZoo/ZooClientApp/Controllers/HomeController.cs b/git/JurasicZoo/ZooClientApp/Controllers/HomeController.cs index c500ef8..59681d4 100644 --- a/git/JurasicZoo/ZooClientApp/Controllers/HomeController.cs +++ b/git/JurasicZoo/ZooClientApp/Controllers/HomeController.cs @@ -246,7 +246,7 @@ namespace ZooClientApp.Controllers { ClientId = APIClient.Client.Id, RoutePreserves = a, - DateStart = dateTime, + RoutePrice = 100, RouteName = name }); diff --git a/git/JurasicZoo/ZooDataBaseImplement/Migrations/20240531220930_InitialCreate.Designer.cs b/git/JurasicZoo/ZooDataBaseImplement/Migrations/20240531234611_InitialCreate.Designer.cs similarity index 93% rename from git/JurasicZoo/ZooDataBaseImplement/Migrations/20240531220930_InitialCreate.Designer.cs rename to git/JurasicZoo/ZooDataBaseImplement/Migrations/20240531234611_InitialCreate.Designer.cs index 75087f1..9122850 100644 --- a/git/JurasicZoo/ZooDataBaseImplement/Migrations/20240531220930_InitialCreate.Designer.cs +++ b/git/JurasicZoo/ZooDataBaseImplement/Migrations/20240531234611_InitialCreate.Designer.cs @@ -12,7 +12,7 @@ using ZooDataBaseImplement; namespace ZooDataBaseImplement.Migrations { [DbContext(typeof(ZooDatabase))] - [Migration("20240531220930_InitialCreate")] + [Migration("20240531234611_InitialCreate")] partial class InitialCreate { /// @@ -20,7 +20,7 @@ namespace ZooDataBaseImplement.Migrations { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "7.0.18") + .HasAnnotation("ProductVersion", "7.0.3") .HasAnnotation("Relational:MaxIdentifierLength", 63); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); @@ -157,8 +157,6 @@ namespace ZooDataBaseImplement.Migrations b.HasIndex("ClientId"); - b.HasIndex("CostId"); - b.ToTable("Routes"); }); @@ -202,12 +200,6 @@ namespace ZooDataBaseImplement.Migrations .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.HasOne("ZooDataBaseImplement.Models.Cost", null) - .WithMany("Routes") - .HasForeignKey("CostId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - b.Navigation("Client"); }); @@ -235,11 +227,6 @@ namespace ZooDataBaseImplement.Migrations b.Navigation("Routes"); }); - modelBuilder.Entity("ZooDataBaseImplement.Models.Cost", b => - { - b.Navigation("Routes"); - }); - modelBuilder.Entity("ZooDataBaseImplement.Models.Employee", b => { b.Navigation("Preserves"); diff --git a/git/JurasicZoo/ZooDataBaseImplement/Migrations/20240531220930_InitialCreate.cs b/git/JurasicZoo/ZooDataBaseImplement/Migrations/20240531234611_InitialCreate.cs similarity index 94% rename from git/JurasicZoo/ZooDataBaseImplement/Migrations/20240531220930_InitialCreate.cs rename to git/JurasicZoo/ZooDataBaseImplement/Migrations/20240531234611_InitialCreate.cs index a582b5c..5b3d259 100644 --- a/git/JurasicZoo/ZooDataBaseImplement/Migrations/20240531220930_InitialCreate.cs +++ b/git/JurasicZoo/ZooDataBaseImplement/Migrations/20240531234611_InitialCreate.cs @@ -80,12 +80,6 @@ namespace ZooDataBaseImplement.Migrations principalTable: "Clients", principalColumn: "Id", onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_Routes_Costs_CostId", - column: x => x.CostId, - principalTable: "Costs", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( @@ -154,16 +148,14 @@ namespace ZooDataBaseImplement.Migrations name: "IX_Routes_ClientId", table: "Routes", column: "ClientId"); - - migrationBuilder.CreateIndex( - name: "IX_Routes_CostId", - table: "Routes", - column: "CostId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { + migrationBuilder.DropTable( + name: "Costs"); + migrationBuilder.DropTable( name: "RoutePreserves"); @@ -178,9 +170,6 @@ namespace ZooDataBaseImplement.Migrations migrationBuilder.DropTable( name: "Clients"); - - migrationBuilder.DropTable( - name: "Costs"); } } } diff --git a/git/JurasicZoo/ZooDataBaseImplement/Migrations/ZooDatabaseModelSnapshot.cs b/git/JurasicZoo/ZooDataBaseImplement/Migrations/ZooDatabaseModelSnapshot.cs index 20a6334..b0e5662 100644 --- a/git/JurasicZoo/ZooDataBaseImplement/Migrations/ZooDatabaseModelSnapshot.cs +++ b/git/JurasicZoo/ZooDataBaseImplement/Migrations/ZooDatabaseModelSnapshot.cs @@ -17,7 +17,7 @@ namespace ZooDataBaseImplement.Migrations { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "7.0.18") + .HasAnnotation("ProductVersion", "7.0.3") .HasAnnotation("Relational:MaxIdentifierLength", 63); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); @@ -154,8 +154,6 @@ namespace ZooDataBaseImplement.Migrations b.HasIndex("ClientId"); - b.HasIndex("CostId"); - b.ToTable("Routes"); }); @@ -199,12 +197,6 @@ namespace ZooDataBaseImplement.Migrations .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.HasOne("ZooDataBaseImplement.Models.Cost", null) - .WithMany("Routes") - .HasForeignKey("CostId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - b.Navigation("Client"); }); @@ -232,11 +224,6 @@ namespace ZooDataBaseImplement.Migrations b.Navigation("Routes"); }); - modelBuilder.Entity("ZooDataBaseImplement.Models.Cost", b => - { - b.Navigation("Routes"); - }); - modelBuilder.Entity("ZooDataBaseImplement.Models.Employee", b => { b.Navigation("Preserves"); diff --git a/git/JurasicZoo/ZooDataBaseImplement/Models/Cost.cs b/git/JurasicZoo/ZooDataBaseImplement/Models/Cost.cs index 65ab53e..5075698 100644 --- a/git/JurasicZoo/ZooDataBaseImplement/Models/Cost.cs +++ b/git/JurasicZoo/ZooDataBaseImplement/Models/Cost.cs @@ -21,8 +21,6 @@ namespace ZooDataBaseImplement.Models public string CostName { get; set; } = string.Empty; [Required] public double CostPrice { get; set; } - [ForeignKey("CostId")] - public virtual List Routes { get; set; } = new(); public static Cost? Create(CostBindingModel model) { if (model == null) diff --git a/git/JurasicZoo/ZooDataBaseImplement/Models/Route.cs b/git/JurasicZoo/ZooDataBaseImplement/Models/Route.cs index 77c27a2..5b46650 100644 --- a/git/JurasicZoo/ZooDataBaseImplement/Models/Route.cs +++ b/git/JurasicZoo/ZooDataBaseImplement/Models/Route.cs @@ -21,7 +21,7 @@ namespace ZooDataBaseImplement.Models public double RoutePrice { get; set; } [Required] public RouteStatus Status { get; private set; } = RouteStatus.Неоплачен; - public DateTime DateStart { get; private set; } + public DateTime DateStart { get; private set; } = DateTime.Now; public DateTime DateFinish { get; private set; } private Dictionary? _routePreserves =