This commit is contained in:
Leozillo73 2024-06-01 03:48:24 +04:00
parent 96084d4797
commit 168d311ee2
6 changed files with 8 additions and 47 deletions

View File

@ -246,7 +246,7 @@ namespace ZooClientApp.Controllers
{
ClientId = APIClient.Client.Id,
RoutePreserves = a,
DateStart = dateTime,
RoutePrice = 100,
RouteName = name
});

View File

@ -12,7 +12,7 @@ using ZooDataBaseImplement;
namespace ZooDataBaseImplement.Migrations
{
[DbContext(typeof(ZooDatabase))]
[Migration("20240531220930_InitialCreate")]
[Migration("20240531234611_InitialCreate")]
partial class InitialCreate
{
/// <inheritdoc />
@ -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");

View File

@ -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");
}
/// <inheritdoc />
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");
}
}
}

View File

@ -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");

View File

@ -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<Route> Routes { get; set; } = new();
public static Cost? Create(CostBindingModel model)
{
if (model == null)

View File

@ -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<int, IPreserveModel>? _routePreserves =