From 6ceaafd33c2eff189c3d4ba239a9084b86a107f6 Mon Sep 17 00:00:00 2001 From: bocchanskyy Date: Sat, 4 May 2024 13:50:48 +0400 Subject: [PATCH] Some fixes + db migration done --- .../ViewModels/OrderViewModel.cs | 2 +- .../Implements/OrderStorage.cs | 23 +- .../Implements/ServiceStorage.cs | 11 - .../20240504094925_InitialCreate.Designer.cs | 519 ++++++++++++++++++ .../20240504094925_InitialCreate.cs | 371 +++++++++++++ .../BeautyStudioDatabaseModelSnapshot.cs | 516 +++++++++++++++++ .../Models/Order.cs | 6 +- .../BeautyStudioView/BeautyStudioView.csproj | 12 + 8 files changed, 1425 insertions(+), 35 deletions(-) create mode 100644 BeautyStudio/BeautyStudioDatabaseImplement/Migrations/20240504094925_InitialCreate.Designer.cs create mode 100644 BeautyStudio/BeautyStudioDatabaseImplement/Migrations/20240504094925_InitialCreate.cs create mode 100644 BeautyStudio/BeautyStudioDatabaseImplement/Migrations/BeautyStudioDatabaseModelSnapshot.cs diff --git a/BeautyStudio/BeautyStudioContracts/ViewModels/OrderViewModel.cs b/BeautyStudio/BeautyStudioContracts/ViewModels/OrderViewModel.cs index b875994..fc2fa2c 100644 --- a/BeautyStudio/BeautyStudioContracts/ViewModels/OrderViewModel.cs +++ b/BeautyStudio/BeautyStudioContracts/ViewModels/OrderViewModel.cs @@ -35,6 +35,6 @@ namespace BeautyStudioContracts.ViewModels public DateTime DateCreate { get; set; } [DisplayName("Дата выполнения")] - public DateTime DateComplete { get; set; } + public DateTime? DateComplete { get; set; } } } diff --git a/BeautyStudio/BeautyStudioDatabaseImplement/Implements/OrderStorage.cs b/BeautyStudio/BeautyStudioDatabaseImplement/Implements/OrderStorage.cs index feacd97..6ecfdfc 100644 --- a/BeautyStudio/BeautyStudioDatabaseImplement/Implements/OrderStorage.cs +++ b/BeautyStudio/BeautyStudioDatabaseImplement/Implements/OrderStorage.cs @@ -20,8 +20,6 @@ namespace BeautyStudioDatabaseImplement.Implements using var context = new BeautyStudioDatabase(); var element = context.Orders .Include(x => x.Services) - .Include(x => x.Procedures) - .Include(x => x.Cosmetics) .FirstOrDefault(rec => rec.Id == model.Id); if (element != null) { @@ -42,10 +40,6 @@ namespace BeautyStudioDatabaseImplement.Implements return context.Orders .Include(x => x.Services) .ThenInclude(x => x.Service) - .Include(x => x.Procedures) - .ThenInclude(x => x.Procedure) - .Include(x => x.Cosmetics) - .ThenInclude(x => x.Cosmetic) .FirstOrDefault(x => x.Id == model.Id) ?.GetViewModel; } @@ -57,17 +51,13 @@ namespace BeautyStudioDatabaseImplement.Implements return new(); } using var context = new BeautyStudioDatabase(); - if (model.ClientId.HasValue && model.OrderDate.HasValue) + if (model.ClientId.HasValue && model.DateCreate.HasValue) { return context.Orders .Include(x => x.Services) .ThenInclude(x => x.Service) - .Include(x => x.Procedures) - .ThenInclude(x => x.Procedure) - .Include(x => x.Cosmetics) - .ThenInclude(x => x.Cosmetic) .Where(x => x.ClientId == model.ClientId && - x.OrderDate == model.OrderDate).ToList() + x.DateCreate == model.DateCreate).ToList() .Select(x => x.GetViewModel) .ToList(); } @@ -89,10 +79,6 @@ namespace BeautyStudioDatabaseImplement.Implements return context.Orders .Include(x => x.Services) .ThenInclude(x => x.Service) - .Include(x => x.Procedures) - .ThenInclude(x => x.Procedure) - .Include(x => x.Cosmetics) - .ThenInclude(x => x.Cosmetic) .ToList() .Select(x => x.GetViewModel) .ToList(); @@ -101,7 +87,7 @@ namespace BeautyStudioDatabaseImplement.Implements public OrderViewModel? Insert(OrderBindingModel model) { using var context = new BeautyStudioDatabase(); - var newOrder = Order_.Create(context, model); + var newOrder = Order.Create(context, model); if (newOrder == null) { return null; @@ -124,9 +110,6 @@ namespace BeautyStudioDatabaseImplement.Implements } order.Update(model); context.SaveChanges(); - order.UpdateServices(context, model); - order.UpdateProcedures(context, model); - order.UpdateCosmetics(context, model); transaction.Commit(); return order.GetViewModel; } diff --git a/BeautyStudio/BeautyStudioDatabaseImplement/Implements/ServiceStorage.cs b/BeautyStudio/BeautyStudioDatabaseImplement/Implements/ServiceStorage.cs index f8e2117..2c1f7d6 100644 --- a/BeautyStudio/BeautyStudioDatabaseImplement/Implements/ServiceStorage.cs +++ b/BeautyStudio/BeautyStudioDatabaseImplement/Implements/ServiceStorage.cs @@ -19,7 +19,6 @@ namespace BeautyStudioDatabaseImplement.Implements using var context = new BeautyStudioDatabase(); var element = context.Services .Include(x => x.Procedures) - .Include(x => x.Cosmetics) .FirstOrDefault(rec => rec.Id == model.Id); if (element != null) { @@ -40,8 +39,6 @@ namespace BeautyStudioDatabaseImplement.Implements return context.Services .Include(x => x.Procedures) .ThenInclude(x => x.Procedure) - .Include(x => x.Cosmetics) - .ThenInclude(x => x.Cosmetic) .FirstOrDefault(x => (!string.IsNullOrEmpty(model.ServiceName) && x.ServiceName == model.ServiceName) || (model.Id.HasValue && x.Id == model.Id)) ?.GetViewModel; @@ -59,8 +56,6 @@ namespace BeautyStudioDatabaseImplement.Implements return context.Services .Include(x => x.Procedures) .ThenInclude(x => x.Procedure) - .Include(x => x.Cosmetics) - .ThenInclude(x => x.Cosmetic) .Where(x => x.Id == model.Id) .ToList() .Select(x => x.GetViewModel) @@ -71,8 +66,6 @@ namespace BeautyStudioDatabaseImplement.Implements return context.Services .Include(x => x.Procedures) .ThenInclude(x => x.Procedure) - .Include(x => x.Cosmetics) - .ThenInclude(x => x.Cosmetic) .Where(x => x.StaffId == model.StaffId) .ToList() .Select(x => x.GetViewModel) @@ -87,8 +80,6 @@ namespace BeautyStudioDatabaseImplement.Implements return context.Services .Include(x => x.Procedures) .ThenInclude(x => x.Procedure) - .Include(x => x.Cosmetics) - .ThenInclude(x => x.Cosmetic) .Select(x => x.GetViewModel) .ToList(); } @@ -119,8 +110,6 @@ namespace BeautyStudioDatabaseImplement.Implements } service.Update(model); context.SaveChanges(); - service.UpdateCosmetics(context, model); - service.UpdateProcedures(context, model); transaction.Commit(); return service.GetViewModel; } diff --git a/BeautyStudio/BeautyStudioDatabaseImplement/Migrations/20240504094925_InitialCreate.Designer.cs b/BeautyStudio/BeautyStudioDatabaseImplement/Migrations/20240504094925_InitialCreate.Designer.cs new file mode 100644 index 0000000..e889619 --- /dev/null +++ b/BeautyStudio/BeautyStudioDatabaseImplement/Migrations/20240504094925_InitialCreate.Designer.cs @@ -0,0 +1,519 @@ +// +using System; +using BeautyStudioDatabaseImplement; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace BeautyStudioDatabaseImplement.Migrations +{ + [DbContext(typeof(BeautyStudioDatabase))] + [Migration("20240504094925_InitialCreate")] + partial class InitialCreate + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.4") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Client", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ClientEmail") + .IsRequired() + .HasColumnType("text"); + + b.Property("ClientFIO") + .IsRequired() + .HasColumnType("text"); + + b.Property("ClientLogin") + .IsRequired() + .HasColumnType("text"); + + b.Property("ClientPassword") + .IsRequired() + .HasColumnType("text"); + + b.Property("ClientPhone") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Clients"); + }); + + modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Cosmetic", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CosmeticName") + .IsRequired() + .HasColumnType("text"); + + b.Property("CosmeticPrice") + .HasColumnType("double precision"); + + b.Property("LaborCostId") + .HasColumnType("integer"); + + b.Property("StoreKeeperId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("LaborCostId"); + + b.HasIndex("StoreKeeperId"); + + b.ToTable("Cosmetics"); + }); + + modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.LaborCost", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Difficulty") + .IsRequired() + .HasColumnType("text"); + + b.Property("StaffId") + .HasColumnType("integer"); + + b.Property("TimeSpent") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("StaffId"); + + b.ToTable("LaborCost"); + }); + + modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Order", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ClientId") + .HasColumnType("integer"); + + b.Property("DateComplete") + .HasColumnType("timestamp with time zone"); + + b.Property("DateCreate") + .HasColumnType("timestamp with time zone"); + + b.Property("ServiceId") + .HasColumnType("integer"); + + b.Property("StaffId") + .IsRequired() + .HasColumnType("integer"); + + b.Property("Status") + .HasColumnType("integer"); + + b.Property("Sum") + .HasColumnType("double precision"); + + b.HasKey("Id"); + + b.HasIndex("ClientId"); + + b.HasIndex("StaffId"); + + b.ToTable("Orders"); + }); + + modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.OrderService", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("OrderId") + .HasColumnType("integer"); + + b.Property("ServiceId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("OrderId"); + + b.HasIndex("ServiceId"); + + b.ToTable("OrderService"); + }); + + modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Procedure", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ClientId") + .HasColumnType("integer"); + + b.Property("ProcedureCost") + .HasColumnType("double precision"); + + b.Property("ProcedureDescription") + .IsRequired() + .HasColumnType("text"); + + b.Property("ProcedureName") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ClientId"); + + b.ToTable("Procedures"); + }); + + modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.ProcedureCosmetics", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CosmeticId") + .HasColumnType("integer"); + + b.Property("ProcedureCosmeticCount") + .HasColumnType("integer"); + + b.Property("ProcedureId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("CosmeticId"); + + b.HasIndex("ProcedureId"); + + b.ToTable("ProcedureCosmetics"); + }); + + modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Service", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ServiceName") + .IsRequired() + .HasColumnType("text"); + + b.Property("StaffId") + .HasColumnType("integer"); + + b.Property("Sum") + .HasColumnType("double precision"); + + b.HasKey("Id"); + + b.HasIndex("StaffId"); + + b.ToTable("Services"); + }); + + modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.ServiceProcedure", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ProcedureId") + .HasColumnType("integer"); + + b.Property("ServiceId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("ProcedureId"); + + b.HasIndex("ServiceId"); + + b.ToTable("ServiceProcedures"); + }); + + modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Staff", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("StaffEmail") + .IsRequired() + .HasColumnType("text"); + + b.Property("StaffFIO") + .IsRequired() + .HasColumnType("text"); + + b.Property("StaffLogin") + .IsRequired() + .HasColumnType("text"); + + b.Property("StaffPassword") + .IsRequired() + .HasColumnType("text"); + + b.Property("StaffPhone") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Staffs"); + }); + + modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.StoreKeeper", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("StoreKeeperEmail") + .IsRequired() + .HasColumnType("text"); + + b.Property("StoreKeeperFIO") + .IsRequired() + .HasColumnType("text"); + + b.Property("StoreKeeperLogin") + .IsRequired() + .HasColumnType("text"); + + b.Property("StoreKeeperPassword") + .IsRequired() + .HasColumnType("text"); + + b.Property("StoreKeeperPhone") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("StoreKeepers"); + }); + + modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Cosmetic", b => + { + b.HasOne("BeautyStudioDatabaseImplement.Models.LaborCost", "LaborCost") + .WithMany("Cosmetics") + .HasForeignKey("LaborCostId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BeautyStudioDatabaseImplement.Models.StoreKeeper", null) + .WithMany("Cosmetics") + .HasForeignKey("StoreKeeperId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("LaborCost"); + }); + + modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.LaborCost", b => + { + b.HasOne("BeautyStudioDatabaseImplement.Models.Staff", "Staff") + .WithMany("LaborCost") + .HasForeignKey("StaffId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Staff"); + }); + + modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Order", b => + { + b.HasOne("BeautyStudioDatabaseImplement.Models.Client", null) + .WithMany("Orders") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BeautyStudioDatabaseImplement.Models.Staff", null) + .WithMany("Orders") + .HasForeignKey("StaffId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.OrderService", b => + { + b.HasOne("BeautyStudioDatabaseImplement.Models.Order", "Order") + .WithMany("Services") + .HasForeignKey("OrderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BeautyStudioDatabaseImplement.Models.Service", "Service") + .WithMany("Orders") + .HasForeignKey("ServiceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Order"); + + b.Navigation("Service"); + }); + + modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Procedure", b => + { + b.HasOne("BeautyStudioDatabaseImplement.Models.Client", "Client") + .WithMany() + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Client"); + }); + + modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.ProcedureCosmetics", b => + { + b.HasOne("BeautyStudioDatabaseImplement.Models.Cosmetic", "Cosmetic") + .WithMany("Procedures") + .HasForeignKey("CosmeticId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BeautyStudioDatabaseImplement.Models.Procedure", "Procedure") + .WithMany("Cosmetics") + .HasForeignKey("ProcedureId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Cosmetic"); + + b.Navigation("Procedure"); + }); + + modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Service", b => + { + b.HasOne("BeautyStudioDatabaseImplement.Models.Staff", "Staff") + .WithMany("Services") + .HasForeignKey("StaffId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Staff"); + }); + + modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.ServiceProcedure", b => + { + b.HasOne("BeautyStudioDatabaseImplement.Models.Procedure", "Procedure") + .WithMany("Services") + .HasForeignKey("ProcedureId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BeautyStudioDatabaseImplement.Models.Service", "Service") + .WithMany("Procedures") + .HasForeignKey("ServiceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Procedure"); + + b.Navigation("Service"); + }); + + modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Client", b => + { + b.Navigation("Orders"); + }); + + modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Cosmetic", b => + { + b.Navigation("Procedures"); + }); + + modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.LaborCost", b => + { + b.Navigation("Cosmetics"); + }); + + modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Order", b => + { + b.Navigation("Services"); + }); + + modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Procedure", b => + { + b.Navigation("Cosmetics"); + + b.Navigation("Services"); + }); + + modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Service", b => + { + b.Navigation("Orders"); + + b.Navigation("Procedures"); + }); + + modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Staff", b => + { + b.Navigation("LaborCost"); + + b.Navigation("Orders"); + + b.Navigation("Services"); + }); + + modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.StoreKeeper", b => + { + b.Navigation("Cosmetics"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/BeautyStudio/BeautyStudioDatabaseImplement/Migrations/20240504094925_InitialCreate.cs b/BeautyStudio/BeautyStudioDatabaseImplement/Migrations/20240504094925_InitialCreate.cs new file mode 100644 index 0000000..3fa7c42 --- /dev/null +++ b/BeautyStudio/BeautyStudioDatabaseImplement/Migrations/20240504094925_InitialCreate.cs @@ -0,0 +1,371 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace BeautyStudioDatabaseImplement.Migrations +{ + /// + public partial class InitialCreate : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Clients", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + ClientLogin = table.Column(type: "text", nullable: false), + ClientFIO = table.Column(type: "text", nullable: false), + ClientEmail = table.Column(type: "text", nullable: false), + ClientPhone = table.Column(type: "text", nullable: false), + ClientPassword = table.Column(type: "text", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Clients", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Staffs", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + StaffFIO = table.Column(type: "text", nullable: false), + StaffEmail = table.Column(type: "text", nullable: false), + StaffLogin = table.Column(type: "text", nullable: false), + StaffPassword = table.Column(type: "text", nullable: false), + StaffPhone = table.Column(type: "text", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Staffs", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "StoreKeepers", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + StoreKeeperFIO = table.Column(type: "text", nullable: false), + StoreKeeperEmail = table.Column(type: "text", nullable: false), + StoreKeeperLogin = table.Column(type: "text", nullable: false), + StoreKeeperPassword = table.Column(type: "text", nullable: false), + StoreKeeperPhone = table.Column(type: "text", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_StoreKeepers", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Procedures", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + ProcedureName = table.Column(type: "text", nullable: false), + ProcedureCost = table.Column(type: "double precision", nullable: false), + ProcedureDescription = table.Column(type: "text", nullable: false), + ClientId = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Procedures", x => x.Id); + table.ForeignKey( + name: "FK_Procedures_Clients_ClientId", + column: x => x.ClientId, + principalTable: "Clients", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "LaborCost", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + TimeSpent = table.Column(type: "integer", nullable: false), + Difficulty = table.Column(type: "text", nullable: false), + StaffId = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_LaborCost", x => x.Id); + table.ForeignKey( + name: "FK_LaborCost_Staffs_StaffId", + column: x => x.StaffId, + principalTable: "Staffs", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Orders", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + DateCreate = table.Column(type: "timestamp with time zone", nullable: false), + DateComplete = table.Column(type: "timestamp with time zone", nullable: true), + Status = table.Column(type: "integer", nullable: false), + Sum = table.Column(type: "double precision", nullable: false), + ClientId = table.Column(type: "integer", nullable: false), + StaffId = table.Column(type: "integer", nullable: false), + ServiceId = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Orders", x => x.Id); + table.ForeignKey( + name: "FK_Orders_Clients_ClientId", + column: x => x.ClientId, + principalTable: "Clients", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Orders_Staffs_StaffId", + column: x => x.StaffId, + principalTable: "Staffs", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Services", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + ServiceName = table.Column(type: "text", nullable: false), + Sum = table.Column(type: "double precision", nullable: false), + StaffId = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Services", x => x.Id); + table.ForeignKey( + name: "FK_Services_Staffs_StaffId", + column: x => x.StaffId, + principalTable: "Staffs", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Cosmetics", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + CosmeticName = table.Column(type: "text", nullable: false), + CosmeticPrice = table.Column(type: "double precision", nullable: false), + StoreKeeperId = table.Column(type: "integer", nullable: false), + LaborCostId = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Cosmetics", x => x.Id); + table.ForeignKey( + name: "FK_Cosmetics_LaborCost_LaborCostId", + column: x => x.LaborCostId, + principalTable: "LaborCost", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Cosmetics_StoreKeepers_StoreKeeperId", + column: x => x.StoreKeeperId, + principalTable: "StoreKeepers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "OrderService", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + OrderId = table.Column(type: "integer", nullable: false), + ServiceId = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_OrderService", x => x.Id); + table.ForeignKey( + name: "FK_OrderService_Orders_OrderId", + column: x => x.OrderId, + principalTable: "Orders", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_OrderService_Services_ServiceId", + column: x => x.ServiceId, + principalTable: "Services", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ServiceProcedures", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + ServiceId = table.Column(type: "integer", nullable: false), + ProcedureId = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ServiceProcedures", x => x.Id); + table.ForeignKey( + name: "FK_ServiceProcedures_Procedures_ProcedureId", + column: x => x.ProcedureId, + principalTable: "Procedures", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ServiceProcedures_Services_ServiceId", + column: x => x.ServiceId, + principalTable: "Services", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ProcedureCosmetics", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + ProcedureId = table.Column(type: "integer", nullable: false), + CosmeticId = table.Column(type: "integer", nullable: false), + ProcedureCosmeticCount = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ProcedureCosmetics", x => x.Id); + table.ForeignKey( + name: "FK_ProcedureCosmetics_Cosmetics_CosmeticId", + column: x => x.CosmeticId, + principalTable: "Cosmetics", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ProcedureCosmetics_Procedures_ProcedureId", + column: x => x.ProcedureId, + principalTable: "Procedures", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_Cosmetics_LaborCostId", + table: "Cosmetics", + column: "LaborCostId"); + + migrationBuilder.CreateIndex( + name: "IX_Cosmetics_StoreKeeperId", + table: "Cosmetics", + column: "StoreKeeperId"); + + migrationBuilder.CreateIndex( + name: "IX_LaborCost_StaffId", + table: "LaborCost", + column: "StaffId"); + + migrationBuilder.CreateIndex( + name: "IX_Orders_ClientId", + table: "Orders", + column: "ClientId"); + + migrationBuilder.CreateIndex( + name: "IX_Orders_StaffId", + table: "Orders", + column: "StaffId"); + + migrationBuilder.CreateIndex( + name: "IX_OrderService_OrderId", + table: "OrderService", + column: "OrderId"); + + migrationBuilder.CreateIndex( + name: "IX_OrderService_ServiceId", + table: "OrderService", + column: "ServiceId"); + + migrationBuilder.CreateIndex( + name: "IX_ProcedureCosmetics_CosmeticId", + table: "ProcedureCosmetics", + column: "CosmeticId"); + + migrationBuilder.CreateIndex( + name: "IX_ProcedureCosmetics_ProcedureId", + table: "ProcedureCosmetics", + column: "ProcedureId"); + + migrationBuilder.CreateIndex( + name: "IX_Procedures_ClientId", + table: "Procedures", + column: "ClientId"); + + migrationBuilder.CreateIndex( + name: "IX_ServiceProcedures_ProcedureId", + table: "ServiceProcedures", + column: "ProcedureId"); + + migrationBuilder.CreateIndex( + name: "IX_ServiceProcedures_ServiceId", + table: "ServiceProcedures", + column: "ServiceId"); + + migrationBuilder.CreateIndex( + name: "IX_Services_StaffId", + table: "Services", + column: "StaffId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "OrderService"); + + migrationBuilder.DropTable( + name: "ProcedureCosmetics"); + + migrationBuilder.DropTable( + name: "ServiceProcedures"); + + migrationBuilder.DropTable( + name: "Orders"); + + migrationBuilder.DropTable( + name: "Cosmetics"); + + migrationBuilder.DropTable( + name: "Procedures"); + + migrationBuilder.DropTable( + name: "Services"); + + migrationBuilder.DropTable( + name: "LaborCost"); + + migrationBuilder.DropTable( + name: "StoreKeepers"); + + migrationBuilder.DropTable( + name: "Clients"); + + migrationBuilder.DropTable( + name: "Staffs"); + } + } +} diff --git a/BeautyStudio/BeautyStudioDatabaseImplement/Migrations/BeautyStudioDatabaseModelSnapshot.cs b/BeautyStudio/BeautyStudioDatabaseImplement/Migrations/BeautyStudioDatabaseModelSnapshot.cs new file mode 100644 index 0000000..3304cc9 --- /dev/null +++ b/BeautyStudio/BeautyStudioDatabaseImplement/Migrations/BeautyStudioDatabaseModelSnapshot.cs @@ -0,0 +1,516 @@ +// +using System; +using BeautyStudioDatabaseImplement; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace BeautyStudioDatabaseImplement.Migrations +{ + [DbContext(typeof(BeautyStudioDatabase))] + partial class BeautyStudioDatabaseModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.4") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Client", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ClientEmail") + .IsRequired() + .HasColumnType("text"); + + b.Property("ClientFIO") + .IsRequired() + .HasColumnType("text"); + + b.Property("ClientLogin") + .IsRequired() + .HasColumnType("text"); + + b.Property("ClientPassword") + .IsRequired() + .HasColumnType("text"); + + b.Property("ClientPhone") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Clients"); + }); + + modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Cosmetic", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CosmeticName") + .IsRequired() + .HasColumnType("text"); + + b.Property("CosmeticPrice") + .HasColumnType("double precision"); + + b.Property("LaborCostId") + .HasColumnType("integer"); + + b.Property("StoreKeeperId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("LaborCostId"); + + b.HasIndex("StoreKeeperId"); + + b.ToTable("Cosmetics"); + }); + + modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.LaborCost", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Difficulty") + .IsRequired() + .HasColumnType("text"); + + b.Property("StaffId") + .HasColumnType("integer"); + + b.Property("TimeSpent") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("StaffId"); + + b.ToTable("LaborCost"); + }); + + modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Order", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ClientId") + .HasColumnType("integer"); + + b.Property("DateComplete") + .HasColumnType("timestamp with time zone"); + + b.Property("DateCreate") + .HasColumnType("timestamp with time zone"); + + b.Property("ServiceId") + .HasColumnType("integer"); + + b.Property("StaffId") + .IsRequired() + .HasColumnType("integer"); + + b.Property("Status") + .HasColumnType("integer"); + + b.Property("Sum") + .HasColumnType("double precision"); + + b.HasKey("Id"); + + b.HasIndex("ClientId"); + + b.HasIndex("StaffId"); + + b.ToTable("Orders"); + }); + + modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.OrderService", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("OrderId") + .HasColumnType("integer"); + + b.Property("ServiceId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("OrderId"); + + b.HasIndex("ServiceId"); + + b.ToTable("OrderService"); + }); + + modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Procedure", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ClientId") + .HasColumnType("integer"); + + b.Property("ProcedureCost") + .HasColumnType("double precision"); + + b.Property("ProcedureDescription") + .IsRequired() + .HasColumnType("text"); + + b.Property("ProcedureName") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ClientId"); + + b.ToTable("Procedures"); + }); + + modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.ProcedureCosmetics", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CosmeticId") + .HasColumnType("integer"); + + b.Property("ProcedureCosmeticCount") + .HasColumnType("integer"); + + b.Property("ProcedureId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("CosmeticId"); + + b.HasIndex("ProcedureId"); + + b.ToTable("ProcedureCosmetics"); + }); + + modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Service", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ServiceName") + .IsRequired() + .HasColumnType("text"); + + b.Property("StaffId") + .HasColumnType("integer"); + + b.Property("Sum") + .HasColumnType("double precision"); + + b.HasKey("Id"); + + b.HasIndex("StaffId"); + + b.ToTable("Services"); + }); + + modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.ServiceProcedure", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ProcedureId") + .HasColumnType("integer"); + + b.Property("ServiceId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("ProcedureId"); + + b.HasIndex("ServiceId"); + + b.ToTable("ServiceProcedures"); + }); + + modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Staff", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("StaffEmail") + .IsRequired() + .HasColumnType("text"); + + b.Property("StaffFIO") + .IsRequired() + .HasColumnType("text"); + + b.Property("StaffLogin") + .IsRequired() + .HasColumnType("text"); + + b.Property("StaffPassword") + .IsRequired() + .HasColumnType("text"); + + b.Property("StaffPhone") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Staffs"); + }); + + modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.StoreKeeper", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("StoreKeeperEmail") + .IsRequired() + .HasColumnType("text"); + + b.Property("StoreKeeperFIO") + .IsRequired() + .HasColumnType("text"); + + b.Property("StoreKeeperLogin") + .IsRequired() + .HasColumnType("text"); + + b.Property("StoreKeeperPassword") + .IsRequired() + .HasColumnType("text"); + + b.Property("StoreKeeperPhone") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("StoreKeepers"); + }); + + modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Cosmetic", b => + { + b.HasOne("BeautyStudioDatabaseImplement.Models.LaborCost", "LaborCost") + .WithMany("Cosmetics") + .HasForeignKey("LaborCostId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BeautyStudioDatabaseImplement.Models.StoreKeeper", null) + .WithMany("Cosmetics") + .HasForeignKey("StoreKeeperId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("LaborCost"); + }); + + modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.LaborCost", b => + { + b.HasOne("BeautyStudioDatabaseImplement.Models.Staff", "Staff") + .WithMany("LaborCost") + .HasForeignKey("StaffId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Staff"); + }); + + modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Order", b => + { + b.HasOne("BeautyStudioDatabaseImplement.Models.Client", null) + .WithMany("Orders") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BeautyStudioDatabaseImplement.Models.Staff", null) + .WithMany("Orders") + .HasForeignKey("StaffId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.OrderService", b => + { + b.HasOne("BeautyStudioDatabaseImplement.Models.Order", "Order") + .WithMany("Services") + .HasForeignKey("OrderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BeautyStudioDatabaseImplement.Models.Service", "Service") + .WithMany("Orders") + .HasForeignKey("ServiceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Order"); + + b.Navigation("Service"); + }); + + modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Procedure", b => + { + b.HasOne("BeautyStudioDatabaseImplement.Models.Client", "Client") + .WithMany() + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Client"); + }); + + modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.ProcedureCosmetics", b => + { + b.HasOne("BeautyStudioDatabaseImplement.Models.Cosmetic", "Cosmetic") + .WithMany("Procedures") + .HasForeignKey("CosmeticId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BeautyStudioDatabaseImplement.Models.Procedure", "Procedure") + .WithMany("Cosmetics") + .HasForeignKey("ProcedureId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Cosmetic"); + + b.Navigation("Procedure"); + }); + + modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Service", b => + { + b.HasOne("BeautyStudioDatabaseImplement.Models.Staff", "Staff") + .WithMany("Services") + .HasForeignKey("StaffId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Staff"); + }); + + modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.ServiceProcedure", b => + { + b.HasOne("BeautyStudioDatabaseImplement.Models.Procedure", "Procedure") + .WithMany("Services") + .HasForeignKey("ProcedureId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BeautyStudioDatabaseImplement.Models.Service", "Service") + .WithMany("Procedures") + .HasForeignKey("ServiceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Procedure"); + + b.Navigation("Service"); + }); + + modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Client", b => + { + b.Navigation("Orders"); + }); + + modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Cosmetic", b => + { + b.Navigation("Procedures"); + }); + + modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.LaborCost", b => + { + b.Navigation("Cosmetics"); + }); + + modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Order", b => + { + b.Navigation("Services"); + }); + + modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Procedure", b => + { + b.Navigation("Cosmetics"); + + b.Navigation("Services"); + }); + + modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Service", b => + { + b.Navigation("Orders"); + + b.Navigation("Procedures"); + }); + + modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Staff", b => + { + b.Navigation("LaborCost"); + + b.Navigation("Orders"); + + b.Navigation("Services"); + }); + + modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.StoreKeeper", b => + { + b.Navigation("Cosmetics"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/BeautyStudio/BeautyStudioDatabaseImplement/Models/Order.cs b/BeautyStudio/BeautyStudioDatabaseImplement/Models/Order.cs index 826c633..93968ef 100644 --- a/BeautyStudio/BeautyStudioDatabaseImplement/Models/Order.cs +++ b/BeautyStudio/BeautyStudioDatabaseImplement/Models/Order.cs @@ -36,9 +36,9 @@ namespace BeautyStudioDatabaseImplement.Models [Required] public int ServiceId { get; set; } - [ForeignKey("ClientId")] - public virtual Client? Client { get; set; } - public virtual Staff? Staff { get; set; } + // связь заказов и услуги многие-ко-многим + [ForeignKey("OrderId")] + public virtual List Services { get; set; } = new(); public static Order Create(BeautyStudioDatabase context, OrderBindingModel model) { diff --git a/BeautyStudio/BeautyStudioView/BeautyStudioView.csproj b/BeautyStudio/BeautyStudioView/BeautyStudioView.csproj index 663fdb8..55e8a58 100644 --- a/BeautyStudio/BeautyStudioView/BeautyStudioView.csproj +++ b/BeautyStudio/BeautyStudioView/BeautyStudioView.csproj @@ -8,4 +8,16 @@ enable + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + \ No newline at end of file