This commit is contained in:
Никита Волков 2024-05-26 23:12:13 +04:00
parent 95030b2368
commit 5ec0741a12
11 changed files with 743 additions and 620 deletions

View File

@ -10,7 +10,6 @@ namespace BeautyStudioContracts.SearchModels
{
public int? Id { get; set; }
public string? ProcedureName { get; set; }
public double? ProcedureCost { get; set; }
public string? ProcedureDescription { get; set; }
}

View File

@ -10,7 +10,6 @@ namespace BeautyStudioContracts.SearchModels
{
public int? Id { get; set; }
public string? ServiceName { get; set; }
public double? ServicePrice { get; set; }
public int? StoreKeeperId { get; set; }
}
}

View File

@ -17,6 +17,10 @@ namespace BeautyStudioContracts.ViewModels
[DisplayName("Стоимость процедуры")]
public double ProcedureCost { get; set; }
[DisplayName("Описание процедуры")]
public string ProcedureDescription { get; set; } = string.Empty;
public string ProcedureDescription { get; set; } = string.Empty;
public List<CosmeticProcedureViewModel> CosmeticProcedures { get; set; } = new();
public List<OrderProcedureViewModel> OrderProcedures { get; set; } = new();
public List<ServiceProcedureViewModel> ServiceProcedure { get; set; } = new();
}
}

View File

@ -17,7 +17,7 @@ namespace BeautyStudioContracts.ViewModels
[DisplayName("Стоимость услуги")]
public double ServicePrice { get; set; }
[DisplayName("Сотрудник")]
public int StoreKeeperId { get; set; }
public List<ServiceCosmeticViewModel> ServiceCosmetic { get; set; } = new();

View File

@ -12,7 +12,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace BeautyStudioDatabaseImplement.Migrations
{
[DbContext(typeof(BeautyStudioDatabase))]
[Migration("20240504094925_InitialCreate")]
[Migration("20240526191135_InitialCreate")]
partial class InitialCreate
{
/// <inheritdoc />
@ -25,39 +25,6 @@ namespace BeautyStudioDatabaseImplement.Migrations
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Client", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("ClientEmail")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ClientFIO")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ClientLogin")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ClientPassword")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ClientPhone")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Clients");
});
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Cosmetic", b =>
{
b.Property<int>("Id")
@ -88,123 +55,7 @@ namespace BeautyStudioDatabaseImplement.Migrations
b.ToTable("Cosmetics");
});
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.LaborCost", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Difficulty")
.IsRequired()
.HasColumnType("text");
b.Property<int>("StaffId")
.HasColumnType("integer");
b.Property<int>("TimeSpent")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("StaffId");
b.ToTable("LaborCost");
});
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Order", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("ClientId")
.HasColumnType("integer");
b.Property<DateTime?>("DateComplete")
.HasColumnType("timestamp with time zone");
b.Property<DateTime>("DateCreate")
.HasColumnType("timestamp with time zone");
b.Property<int>("ServiceId")
.HasColumnType("integer");
b.Property<int?>("StaffId")
.IsRequired()
.HasColumnType("integer");
b.Property<int>("Status")
.HasColumnType("integer");
b.Property<double>("Sum")
.HasColumnType("double precision");
b.HasKey("Id");
b.HasIndex("ClientId");
b.HasIndex("StaffId");
b.ToTable("Orders");
});
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.OrderService", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("OrderId")
.HasColumnType("integer");
b.Property<int>("ServiceId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("OrderId");
b.HasIndex("ServiceId");
b.ToTable("OrderService");
});
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Procedure", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("ClientId")
.HasColumnType("integer");
b.Property<double>("ProcedureCost")
.HasColumnType("double precision");
b.Property<string>("ProcedureDescription")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ProcedureName")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("Procedures");
});
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.ProcedureCosmetics", b =>
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.CosmeticProcedure", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
@ -227,7 +78,166 @@ namespace BeautyStudioDatabaseImplement.Migrations
b.HasIndex("ProcedureId");
b.ToTable("ProcedureCosmetics");
b.ToTable("CosmeticProcedures");
});
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.LaborCost", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Difficulty")
.IsRequired()
.HasColumnType("text");
b.Property<int>("StoreKeeperId")
.HasColumnType("integer");
b.Property<int>("TimeSpent")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("StoreKeeperId");
b.ToTable("LaborCost");
});
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Order", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("CosmeticId")
.HasColumnType("integer");
b.Property<DateTime?>("DateComplete")
.HasColumnType("timestamp with time zone");
b.Property<DateTime>("DateCreate")
.HasColumnType("timestamp with time zone");
b.Property<int>("ServiceId")
.HasColumnType("integer");
b.Property<int>("Status")
.HasColumnType("integer");
b.Property<int?>("StoreKeeperId")
.IsRequired()
.HasColumnType("integer");
b.Property<double>("Sum")
.HasColumnType("double precision");
b.HasKey("Id");
b.ToTable("Orders");
});
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.OrderCosmetic", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("CosmeticId")
.HasColumnType("integer");
b.Property<int>("OrderId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("CosmeticId");
b.HasIndex("OrderId");
b.ToTable("OrderCosmetics");
});
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.OrderProcedure", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("OrderId")
.HasColumnType("integer");
b.Property<int>("OrderProcedureCount")
.HasColumnType("integer");
b.Property<int>("ProcedureId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("OrderId");
b.HasIndex("ProcedureId");
b.ToTable("OrderProcedures");
});
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.OrderService", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("OrderId")
.HasColumnType("integer");
b.Property<int>("OrderServiceCount")
.HasColumnType("integer");
b.Property<int>("ServiceId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("OrderId");
b.HasIndex("ServiceId");
b.ToTable("OrderServices");
});
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Procedure", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<double>("ProcedureCost")
.HasColumnType("double precision");
b.Property<string>("ProcedureDescription")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ProcedureName")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Procedures");
});
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Service", b =>
@ -242,19 +252,45 @@ namespace BeautyStudioDatabaseImplement.Migrations
.IsRequired()
.HasColumnType("text");
b.Property<int>("StaffId")
.HasColumnType("integer");
b.Property<double>("Sum")
b.Property<double>("ServicePrice")
.HasColumnType("double precision");
b.Property<int>("StoreKeeperId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("StaffId");
b.HasIndex("StoreKeeperId");
b.ToTable("Services");
});
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.ServiceCosmetic", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("CosmeticId")
.HasColumnType("integer");
b.Property<int>("ServiceCosmeticCount")
.HasColumnType("integer");
b.Property<int>("ServiceId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("CosmeticId");
b.HasIndex("ServiceId");
b.ToTable("ServiceCosmetics");
});
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.ServiceProcedure", b =>
{
b.Property<int>("Id")
@ -269,6 +305,9 @@ namespace BeautyStudioDatabaseImplement.Migrations
b.Property<int>("ServiceId")
.HasColumnType("integer");
b.Property<int>("ServiceProcedureCount")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("ProcedureId");
@ -278,39 +317,6 @@ namespace BeautyStudioDatabaseImplement.Migrations
b.ToTable("ServiceProcedures");
});
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Staff", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("StaffEmail")
.IsRequired()
.HasColumnType("text");
b.Property<string>("StaffFIO")
.IsRequired()
.HasColumnType("text");
b.Property<string>("StaffLogin")
.IsRequired()
.HasColumnType("text");
b.Property<string>("StaffPassword")
.IsRequired()
.HasColumnType("text");
b.Property<string>("StaffPhone")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Staffs");
});
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.StoreKeeper", b =>
{
b.Property<int>("Id")
@ -361,30 +367,72 @@ namespace BeautyStudioDatabaseImplement.Migrations
b.Navigation("LaborCost");
});
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.LaborCost", b =>
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.CosmeticProcedure", b =>
{
b.HasOne("BeautyStudioDatabaseImplement.Models.Staff", "Staff")
.WithMany("LaborCost")
.HasForeignKey("StaffId")
b.HasOne("BeautyStudioDatabaseImplement.Models.Cosmetic", "Cosmetic")
.WithMany("Procedures")
.HasForeignKey("CosmeticId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Staff");
b.HasOne("BeautyStudioDatabaseImplement.Models.Procedure", "Procedure")
.WithMany("Cosmetics")
.HasForeignKey("ProcedureId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Cosmetic");
b.Navigation("Procedure");
});
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Order", b =>
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.LaborCost", b =>
{
b.HasOne("BeautyStudioDatabaseImplement.Models.Client", null)
.WithMany("Orders")
.HasForeignKey("ClientId")
b.HasOne("BeautyStudioDatabaseImplement.Models.StoreKeeper", "StoreKeeper")
.WithMany()
.HasForeignKey("StoreKeeperId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BeautyStudioDatabaseImplement.Models.Staff", null)
b.Navigation("StoreKeeper");
});
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.OrderCosmetic", b =>
{
b.HasOne("BeautyStudioDatabaseImplement.Models.Cosmetic", "Cosmetic")
.WithMany("Orders")
.HasForeignKey("StaffId")
.HasForeignKey("CosmeticId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BeautyStudioDatabaseImplement.Models.Order", "Order")
.WithMany("Cosmetics")
.HasForeignKey("OrderId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Cosmetic");
b.Navigation("Order");
});
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.OrderProcedure", b =>
{
b.HasOne("BeautyStudioDatabaseImplement.Models.Order", "Order")
.WithMany("Procedures")
.HasForeignKey("OrderId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BeautyStudioDatabaseImplement.Models.Procedure", "Procedure")
.WithMany("Orders")
.HasForeignKey("ProcedureId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Order");
b.Navigation("Procedure");
});
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.OrderService", b =>
@ -406,45 +454,34 @@ namespace BeautyStudioDatabaseImplement.Migrations
b.Navigation("Service");
});
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Procedure", b =>
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Service", b =>
{
b.HasOne("BeautyStudioDatabaseImplement.Models.Client", "Client")
b.HasOne("BeautyStudioDatabaseImplement.Models.StoreKeeper", "StoreKeeper")
.WithMany()
.HasForeignKey("ClientId")
.HasForeignKey("StoreKeeperId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
b.Navigation("StoreKeeper");
});
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.ProcedureCosmetics", b =>
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.ServiceCosmetic", b =>
{
b.HasOne("BeautyStudioDatabaseImplement.Models.Cosmetic", "Cosmetic")
.WithMany("Procedures")
.WithMany("Services")
.HasForeignKey("CosmeticId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BeautyStudioDatabaseImplement.Models.Procedure", "Procedure")
b.HasOne("BeautyStudioDatabaseImplement.Models.Service", "Service")
.WithMany("Cosmetics")
.HasForeignKey("ProcedureId")
.HasForeignKey("ServiceId")
.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");
b.Navigation("Service");
});
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.ServiceProcedure", b =>
@ -466,14 +503,13 @@ namespace BeautyStudioDatabaseImplement.Migrations
b.Navigation("Service");
});
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Client", b =>
{
b.Navigation("Orders");
});
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Cosmetic", b =>
{
b.Navigation("Orders");
b.Navigation("Procedures");
b.Navigation("Services");
});
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.LaborCost", b =>
@ -483,6 +519,10 @@ namespace BeautyStudioDatabaseImplement.Migrations
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Order", b =>
{
b.Navigation("Cosmetics");
b.Navigation("Procedures");
b.Navigation("Services");
});
@ -490,25 +530,20 @@ namespace BeautyStudioDatabaseImplement.Migrations
{
b.Navigation("Cosmetics");
b.Navigation("Orders");
b.Navigation("Services");
});
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Service", b =>
{
b.Navigation("Cosmetics");
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");

View File

@ -13,37 +13,37 @@ namespace BeautyStudioDatabaseImplement.Migrations
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Clients",
name: "Orders",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ClientLogin = table.Column<string>(type: "text", nullable: false),
ClientFIO = table.Column<string>(type: "text", nullable: false),
ClientEmail = table.Column<string>(type: "text", nullable: false),
ClientPhone = table.Column<string>(type: "text", nullable: false),
ClientPassword = table.Column<string>(type: "text", nullable: false)
DateCreate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
DateComplete = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
Status = table.Column<int>(type: "integer", nullable: false),
Sum = table.Column<double>(type: "double precision", nullable: false),
StoreKeeperId = table.Column<int>(type: "integer", nullable: false),
ServiceId = table.Column<int>(type: "integer", nullable: false),
CosmeticId = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Clients", x => x.Id);
table.PrimaryKey("PK_Orders", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Staffs",
name: "Procedures",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
StaffFIO = table.Column<string>(type: "text", nullable: false),
StaffEmail = table.Column<string>(type: "text", nullable: false),
StaffLogin = table.Column<string>(type: "text", nullable: false),
StaffPassword = table.Column<string>(type: "text", nullable: false),
StaffPhone = table.Column<string>(type: "text", nullable: false)
ProcedureName = table.Column<string>(type: "text", nullable: false),
ProcedureCost = table.Column<double>(type: "double precision", nullable: false),
ProcedureDescription = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Staffs", x => x.Id);
table.PrimaryKey("PK_Procedures", x => x.Id);
});
migrationBuilder.CreateTable(
@ -64,23 +64,28 @@ namespace BeautyStudioDatabaseImplement.Migrations
});
migrationBuilder.CreateTable(
name: "Procedures",
name: "OrderProcedures",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ProcedureName = table.Column<string>(type: "text", nullable: false),
ProcedureCost = table.Column<double>(type: "double precision", nullable: false),
ProcedureDescription = table.Column<string>(type: "text", nullable: false),
ClientId = table.Column<int>(type: "integer", nullable: false)
OrderId = table.Column<int>(type: "integer", nullable: false),
ProcedureId = table.Column<int>(type: "integer", nullable: false),
OrderProcedureCount = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Procedures", x => x.Id);
table.PrimaryKey("PK_OrderProcedures", x => x.Id);
table.ForeignKey(
name: "FK_Procedures_Clients_ClientId",
column: x => x.ClientId,
principalTable: "Clients",
name: "FK_OrderProcedures_Orders_OrderId",
column: x => x.OrderId,
principalTable: "Orders",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_OrderProcedures_Procedures_ProcedureId",
column: x => x.ProcedureId,
principalTable: "Procedures",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
@ -93,46 +98,15 @@ namespace BeautyStudioDatabaseImplement.Migrations
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
TimeSpent = table.Column<int>(type: "integer", nullable: false),
Difficulty = table.Column<string>(type: "text", nullable: false),
StaffId = table.Column<int>(type: "integer", nullable: false)
StoreKeeperId = table.Column<int>(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<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
DateCreate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
DateComplete = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
Status = table.Column<int>(type: "integer", nullable: false),
Sum = table.Column<double>(type: "double precision", nullable: false),
ClientId = table.Column<int>(type: "integer", nullable: false),
StaffId = table.Column<int>(type: "integer", nullable: false),
ServiceId = table.Column<int>(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",
name: "FK_LaborCost_StoreKeepers_StoreKeeperId",
column: x => x.StoreKeeperId,
principalTable: "StoreKeepers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
@ -144,16 +118,16 @@ namespace BeautyStudioDatabaseImplement.Migrations
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ServiceName = table.Column<string>(type: "text", nullable: false),
Sum = table.Column<double>(type: "double precision", nullable: false),
StaffId = table.Column<int>(type: "integer", nullable: false)
ServicePrice = table.Column<double>(type: "double precision", nullable: false),
StoreKeeperId = table.Column<int>(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",
name: "FK_Services_StoreKeepers_StoreKeeperId",
column: x => x.StoreKeeperId,
principalTable: "StoreKeepers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
@ -187,25 +161,26 @@ namespace BeautyStudioDatabaseImplement.Migrations
});
migrationBuilder.CreateTable(
name: "OrderService",
name: "OrderServices",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
OrderId = table.Column<int>(type: "integer", nullable: false),
ServiceId = table.Column<int>(type: "integer", nullable: false)
ServiceId = table.Column<int>(type: "integer", nullable: false),
OrderServiceCount = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_OrderService", x => x.Id);
table.PrimaryKey("PK_OrderServices", x => x.Id);
table.ForeignKey(
name: "FK_OrderService_Orders_OrderId",
name: "FK_OrderServices_Orders_OrderId",
column: x => x.OrderId,
principalTable: "Orders",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_OrderService_Services_ServiceId",
name: "FK_OrderServices_Services_ServiceId",
column: x => x.ServiceId,
principalTable: "Services",
principalColumn: "Id",
@ -219,7 +194,8 @@ namespace BeautyStudioDatabaseImplement.Migrations
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ServiceId = table.Column<int>(type: "integer", nullable: false),
ProcedureId = table.Column<int>(type: "integer", nullable: false)
ProcedureId = table.Column<int>(type: "integer", nullable: false),
ServiceProcedureCount = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
@ -239,32 +215,95 @@ namespace BeautyStudioDatabaseImplement.Migrations
});
migrationBuilder.CreateTable(
name: "ProcedureCosmetics",
name: "CosmeticProcedures",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ProcedureId = table.Column<int>(type: "integer", nullable: false),
CosmeticId = table.Column<int>(type: "integer", nullable: false),
ProcedureId = table.Column<int>(type: "integer", nullable: false),
ProcedureCosmeticCount = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ProcedureCosmetics", x => x.Id);
table.PrimaryKey("PK_CosmeticProcedures", x => x.Id);
table.ForeignKey(
name: "FK_ProcedureCosmetics_Cosmetics_CosmeticId",
name: "FK_CosmeticProcedures_Cosmetics_CosmeticId",
column: x => x.CosmeticId,
principalTable: "Cosmetics",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_ProcedureCosmetics_Procedures_ProcedureId",
name: "FK_CosmeticProcedures_Procedures_ProcedureId",
column: x => x.ProcedureId,
principalTable: "Procedures",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "OrderCosmetics",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
OrderId = table.Column<int>(type: "integer", nullable: false),
CosmeticId = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_OrderCosmetics", x => x.Id);
table.ForeignKey(
name: "FK_OrderCosmetics_Cosmetics_CosmeticId",
column: x => x.CosmeticId,
principalTable: "Cosmetics",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_OrderCosmetics_Orders_OrderId",
column: x => x.OrderId,
principalTable: "Orders",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ServiceCosmetics",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
CosmeticId = table.Column<int>(type: "integer", nullable: false),
ServiceId = table.Column<int>(type: "integer", nullable: false),
ServiceCosmeticCount = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ServiceCosmetics", x => x.Id);
table.ForeignKey(
name: "FK_ServiceCosmetics_Cosmetics_CosmeticId",
column: x => x.CosmeticId,
principalTable: "Cosmetics",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_ServiceCosmetics_Services_ServiceId",
column: x => x.ServiceId,
principalTable: "Services",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_CosmeticProcedures_CosmeticId",
table: "CosmeticProcedures",
column: "CosmeticId");
migrationBuilder.CreateIndex(
name: "IX_CosmeticProcedures_ProcedureId",
table: "CosmeticProcedures",
column: "ProcedureId");
migrationBuilder.CreateIndex(
name: "IX_Cosmetics_LaborCostId",
table: "Cosmetics",
@ -276,44 +315,49 @@ namespace BeautyStudioDatabaseImplement.Migrations
column: "StoreKeeperId");
migrationBuilder.CreateIndex(
name: "IX_LaborCost_StaffId",
name: "IX_LaborCost_StoreKeeperId",
table: "LaborCost",
column: "StaffId");
column: "StoreKeeperId");
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",
name: "IX_OrderCosmetics_CosmeticId",
table: "OrderCosmetics",
column: "CosmeticId");
migrationBuilder.CreateIndex(
name: "IX_ProcedureCosmetics_ProcedureId",
table: "ProcedureCosmetics",
name: "IX_OrderCosmetics_OrderId",
table: "OrderCosmetics",
column: "OrderId");
migrationBuilder.CreateIndex(
name: "IX_OrderProcedures_OrderId",
table: "OrderProcedures",
column: "OrderId");
migrationBuilder.CreateIndex(
name: "IX_OrderProcedures_ProcedureId",
table: "OrderProcedures",
column: "ProcedureId");
migrationBuilder.CreateIndex(
name: "IX_Procedures_ClientId",
table: "Procedures",
column: "ClientId");
name: "IX_OrderServices_OrderId",
table: "OrderServices",
column: "OrderId");
migrationBuilder.CreateIndex(
name: "IX_OrderServices_ServiceId",
table: "OrderServices",
column: "ServiceId");
migrationBuilder.CreateIndex(
name: "IX_ServiceCosmetics_CosmeticId",
table: "ServiceCosmetics",
column: "CosmeticId");
migrationBuilder.CreateIndex(
name: "IX_ServiceCosmetics_ServiceId",
table: "ServiceCosmetics",
column: "ServiceId");
migrationBuilder.CreateIndex(
name: "IX_ServiceProcedures_ProcedureId",
@ -326,19 +370,28 @@ namespace BeautyStudioDatabaseImplement.Migrations
column: "ServiceId");
migrationBuilder.CreateIndex(
name: "IX_Services_StaffId",
name: "IX_Services_StoreKeeperId",
table: "Services",
column: "StaffId");
column: "StoreKeeperId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "OrderService");
name: "CosmeticProcedures");
migrationBuilder.DropTable(
name: "ProcedureCosmetics");
name: "OrderCosmetics");
migrationBuilder.DropTable(
name: "OrderProcedures");
migrationBuilder.DropTable(
name: "OrderServices");
migrationBuilder.DropTable(
name: "ServiceCosmetics");
migrationBuilder.DropTable(
name: "ServiceProcedures");
@ -360,12 +413,6 @@ namespace BeautyStudioDatabaseImplement.Migrations
migrationBuilder.DropTable(
name: "StoreKeepers");
migrationBuilder.DropTable(
name: "Clients");
migrationBuilder.DropTable(
name: "Staffs");
}
}
}

View File

@ -22,39 +22,6 @@ namespace BeautyStudioDatabaseImplement.Migrations
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Client", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("ClientEmail")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ClientFIO")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ClientLogin")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ClientPassword")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ClientPhone")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Clients");
});
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Cosmetic", b =>
{
b.Property<int>("Id")
@ -85,123 +52,7 @@ namespace BeautyStudioDatabaseImplement.Migrations
b.ToTable("Cosmetics");
});
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.LaborCost", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Difficulty")
.IsRequired()
.HasColumnType("text");
b.Property<int>("StaffId")
.HasColumnType("integer");
b.Property<int>("TimeSpent")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("StaffId");
b.ToTable("LaborCost");
});
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Order", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("ClientId")
.HasColumnType("integer");
b.Property<DateTime?>("DateComplete")
.HasColumnType("timestamp with time zone");
b.Property<DateTime>("DateCreate")
.HasColumnType("timestamp with time zone");
b.Property<int>("ServiceId")
.HasColumnType("integer");
b.Property<int?>("StaffId")
.IsRequired()
.HasColumnType("integer");
b.Property<int>("Status")
.HasColumnType("integer");
b.Property<double>("Sum")
.HasColumnType("double precision");
b.HasKey("Id");
b.HasIndex("ClientId");
b.HasIndex("StaffId");
b.ToTable("Orders");
});
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.OrderService", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("OrderId")
.HasColumnType("integer");
b.Property<int>("ServiceId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("OrderId");
b.HasIndex("ServiceId");
b.ToTable("OrderService");
});
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Procedure", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("ClientId")
.HasColumnType("integer");
b.Property<double>("ProcedureCost")
.HasColumnType("double precision");
b.Property<string>("ProcedureDescription")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ProcedureName")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ClientId");
b.ToTable("Procedures");
});
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.ProcedureCosmetics", b =>
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.CosmeticProcedure", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
@ -224,7 +75,166 @@ namespace BeautyStudioDatabaseImplement.Migrations
b.HasIndex("ProcedureId");
b.ToTable("ProcedureCosmetics");
b.ToTable("CosmeticProcedures");
});
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.LaborCost", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Difficulty")
.IsRequired()
.HasColumnType("text");
b.Property<int>("StoreKeeperId")
.HasColumnType("integer");
b.Property<int>("TimeSpent")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("StoreKeeperId");
b.ToTable("LaborCost");
});
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Order", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("CosmeticId")
.HasColumnType("integer");
b.Property<DateTime?>("DateComplete")
.HasColumnType("timestamp with time zone");
b.Property<DateTime>("DateCreate")
.HasColumnType("timestamp with time zone");
b.Property<int>("ServiceId")
.HasColumnType("integer");
b.Property<int>("Status")
.HasColumnType("integer");
b.Property<int?>("StoreKeeperId")
.IsRequired()
.HasColumnType("integer");
b.Property<double>("Sum")
.HasColumnType("double precision");
b.HasKey("Id");
b.ToTable("Orders");
});
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.OrderCosmetic", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("CosmeticId")
.HasColumnType("integer");
b.Property<int>("OrderId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("CosmeticId");
b.HasIndex("OrderId");
b.ToTable("OrderCosmetics");
});
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.OrderProcedure", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("OrderId")
.HasColumnType("integer");
b.Property<int>("OrderProcedureCount")
.HasColumnType("integer");
b.Property<int>("ProcedureId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("OrderId");
b.HasIndex("ProcedureId");
b.ToTable("OrderProcedures");
});
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.OrderService", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("OrderId")
.HasColumnType("integer");
b.Property<int>("OrderServiceCount")
.HasColumnType("integer");
b.Property<int>("ServiceId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("OrderId");
b.HasIndex("ServiceId");
b.ToTable("OrderServices");
});
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Procedure", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<double>("ProcedureCost")
.HasColumnType("double precision");
b.Property<string>("ProcedureDescription")
.IsRequired()
.HasColumnType("text");
b.Property<string>("ProcedureName")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Procedures");
});
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Service", b =>
@ -239,19 +249,45 @@ namespace BeautyStudioDatabaseImplement.Migrations
.IsRequired()
.HasColumnType("text");
b.Property<int>("StaffId")
.HasColumnType("integer");
b.Property<double>("Sum")
b.Property<double>("ServicePrice")
.HasColumnType("double precision");
b.Property<int>("StoreKeeperId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("StaffId");
b.HasIndex("StoreKeeperId");
b.ToTable("Services");
});
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.ServiceCosmetic", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("CosmeticId")
.HasColumnType("integer");
b.Property<int>("ServiceCosmeticCount")
.HasColumnType("integer");
b.Property<int>("ServiceId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("CosmeticId");
b.HasIndex("ServiceId");
b.ToTable("ServiceCosmetics");
});
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.ServiceProcedure", b =>
{
b.Property<int>("Id")
@ -266,6 +302,9 @@ namespace BeautyStudioDatabaseImplement.Migrations
b.Property<int>("ServiceId")
.HasColumnType("integer");
b.Property<int>("ServiceProcedureCount")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("ProcedureId");
@ -275,39 +314,6 @@ namespace BeautyStudioDatabaseImplement.Migrations
b.ToTable("ServiceProcedures");
});
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Staff", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("StaffEmail")
.IsRequired()
.HasColumnType("text");
b.Property<string>("StaffFIO")
.IsRequired()
.HasColumnType("text");
b.Property<string>("StaffLogin")
.IsRequired()
.HasColumnType("text");
b.Property<string>("StaffPassword")
.IsRequired()
.HasColumnType("text");
b.Property<string>("StaffPhone")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Staffs");
});
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.StoreKeeper", b =>
{
b.Property<int>("Id")
@ -358,30 +364,72 @@ namespace BeautyStudioDatabaseImplement.Migrations
b.Navigation("LaborCost");
});
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.LaborCost", b =>
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.CosmeticProcedure", b =>
{
b.HasOne("BeautyStudioDatabaseImplement.Models.Staff", "Staff")
.WithMany("LaborCost")
.HasForeignKey("StaffId")
b.HasOne("BeautyStudioDatabaseImplement.Models.Cosmetic", "Cosmetic")
.WithMany("Procedures")
.HasForeignKey("CosmeticId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Staff");
b.HasOne("BeautyStudioDatabaseImplement.Models.Procedure", "Procedure")
.WithMany("Cosmetics")
.HasForeignKey("ProcedureId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Cosmetic");
b.Navigation("Procedure");
});
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Order", b =>
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.LaborCost", b =>
{
b.HasOne("BeautyStudioDatabaseImplement.Models.Client", null)
.WithMany("Orders")
.HasForeignKey("ClientId")
b.HasOne("BeautyStudioDatabaseImplement.Models.StoreKeeper", "StoreKeeper")
.WithMany()
.HasForeignKey("StoreKeeperId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BeautyStudioDatabaseImplement.Models.Staff", null)
b.Navigation("StoreKeeper");
});
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.OrderCosmetic", b =>
{
b.HasOne("BeautyStudioDatabaseImplement.Models.Cosmetic", "Cosmetic")
.WithMany("Orders")
.HasForeignKey("StaffId")
.HasForeignKey("CosmeticId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BeautyStudioDatabaseImplement.Models.Order", "Order")
.WithMany("Cosmetics")
.HasForeignKey("OrderId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Cosmetic");
b.Navigation("Order");
});
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.OrderProcedure", b =>
{
b.HasOne("BeautyStudioDatabaseImplement.Models.Order", "Order")
.WithMany("Procedures")
.HasForeignKey("OrderId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BeautyStudioDatabaseImplement.Models.Procedure", "Procedure")
.WithMany("Orders")
.HasForeignKey("ProcedureId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Order");
b.Navigation("Procedure");
});
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.OrderService", b =>
@ -403,45 +451,34 @@ namespace BeautyStudioDatabaseImplement.Migrations
b.Navigation("Service");
});
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Procedure", b =>
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Service", b =>
{
b.HasOne("BeautyStudioDatabaseImplement.Models.Client", "Client")
b.HasOne("BeautyStudioDatabaseImplement.Models.StoreKeeper", "StoreKeeper")
.WithMany()
.HasForeignKey("ClientId")
.HasForeignKey("StoreKeeperId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
b.Navigation("StoreKeeper");
});
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.ProcedureCosmetics", b =>
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.ServiceCosmetic", b =>
{
b.HasOne("BeautyStudioDatabaseImplement.Models.Cosmetic", "Cosmetic")
.WithMany("Procedures")
.WithMany("Services")
.HasForeignKey("CosmeticId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BeautyStudioDatabaseImplement.Models.Procedure", "Procedure")
b.HasOne("BeautyStudioDatabaseImplement.Models.Service", "Service")
.WithMany("Cosmetics")
.HasForeignKey("ProcedureId")
.HasForeignKey("ServiceId")
.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");
b.Navigation("Service");
});
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.ServiceProcedure", b =>
@ -463,14 +500,13 @@ namespace BeautyStudioDatabaseImplement.Migrations
b.Navigation("Service");
});
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Client", b =>
{
b.Navigation("Orders");
});
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Cosmetic", b =>
{
b.Navigation("Orders");
b.Navigation("Procedures");
b.Navigation("Services");
});
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.LaborCost", b =>
@ -480,6 +516,10 @@ namespace BeautyStudioDatabaseImplement.Migrations
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Order", b =>
{
b.Navigation("Cosmetics");
b.Navigation("Procedures");
b.Navigation("Services");
});
@ -487,25 +527,20 @@ namespace BeautyStudioDatabaseImplement.Migrations
{
b.Navigation("Cosmetics");
b.Navigation("Orders");
b.Navigation("Services");
});
modelBuilder.Entity("BeautyStudioDatabaseImplement.Models.Service", b =>
{
b.Navigation("Cosmetics");
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");

View File

@ -26,17 +26,17 @@ namespace BeautyStudioDatabaseImplement.Models
// связь процедур и косметики многие - ко - многим
[ForeignKey("ProcedureId")]
public virtual List<ServiceCosmetic> Cosmetics { get; set; } = new();
public virtual List<CosmeticProcedure> Cosmetics { get; set; } = new();
private List<ProcedureCosmeticsViewModel>? _cosmeticProcedures = null;
private List<CosmeticProcedureViewModel>? _cosmeticProcedures = null;
[NotMapped]
public List<ProcedureCosmeticsViewModel> CosmeticProcedures
public List<CosmeticProcedureViewModel> CosmeticProcedures
{
get
{
_cosmeticProcedures ??= Cosmetics
.Select(pc => new ProcedureCosmeticsViewModel(pc.Cosmetic.GetViewModel, pc.Procedure.GetViewModel, pc.ProcedureCosmeticCount))
.Select(pc => new CosmeticProcedureViewModel(pc.Cosmetic.GetViewModel, pc.Procedure.GetViewModel, pc.ProcedureCosmeticCount))
.ToList();
return _cosmeticProcedures;
}
@ -79,6 +79,7 @@ namespace BeautyStudioDatabaseImplement.Models
ProcedureName = ProcedureName,
ProcedureCost = ProcedureCost,
ProcedureDescription = ProcedureDescription,
CosmeticProcedures = CosmeticProcedures
};
public void UpdateCosmetics(BeautyStudioDatabase context, ProcedureBindingModel model)

View File

@ -72,7 +72,18 @@ namespace BeautyStudioDatabaseImplement.Models
{
Id = model.Id,
ServiceName = model.ServiceName,
ServicePrice = model.ServicePrice
ServicePrice = model.ServicePrice,
Cosmetics = model.ServiceCosmetic.Select(x => new ServiceCosmetic()
{
Cosmetic = context.Cosmetics.First(y => y.Id == x.Cosmetic.Id),
ServiceCosmeticCount = x.Count
}).ToList(),
Procedures = model.ServiceProcedure.Select(x => new ServiceProcedure()
{
Procedure = context.Procedures.First(y => y.Id == x.Procedure.Id),
ServiceProcedureCount = x.Count
}).ToList(),
StoreKeeperId = model.StoreKeeperId
};
}
@ -80,13 +91,17 @@ namespace BeautyStudioDatabaseImplement.Models
{
ServiceName = model.ServiceName;
ServicePrice = model.ServicePrice;
StoreKeeperId = model.StoreKeeperId;
}
public ServiceViewModel GetViewModel => new()
{
Id = Id,
ServiceName = ServiceName,
ServicePrice = ServicePrice
ServicePrice = ServicePrice,
ServiceCosmetic = ServiceCosmetics,
ServiceProcedure = ServiceProcedures,
StoreKeeperId = StoreKeeperId
};
public void UpdateCosmetics(BeautyStudioDatabase context, ServiceBindingModel model)

View File

@ -3,7 +3,6 @@ using BeautyStudioContracts.BusinessLogicContracts;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.CosmeticModel;
using System.Data;
using System.Drawing;
using System.Linq;

View File

@ -4,6 +4,7 @@ using BeautyStudioContracts.BusinessLogicContracts;
using BeautyStudioContracts.StoragesContracts;
using BeautyStudioDatabaseImplement.Implements;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using NLog.Extensions.Logging;
namespace BeautyStudioView
@ -34,36 +35,24 @@ namespace BeautyStudioView
option.SetMinimumLevel(LogLevel.Information);
option.AddNLog("nlog.config");
});
services.AddTransient<IComponentStorage, ComponentStorage>();
services.AddTransient<IComputerStorage, ComputerStorage>();
services.AddTransient<IOrderStorage, OrderStorage>();
services.AddTransient<IClientStorage, ClientStorage>();
services.AddTransient<IImplementerStorage, ImplementerStorage>();
//services.AddTransient<IComponentStorage, ComponentStorage>();
//services.AddTransient<IComputerStorage, ComputerStorage>();
//services.AddTransient<IOrderStorage, OrderStorage>();
services.AddTransient<IComponentLogic, ComponentLogic>();
services.AddTransient<IComputerLogic, ComputerLogic>();
services.AddTransient<IOrderLogic, OrderLogic>();
services.AddTransient<IReportLogic, ReportLogic>();
services.AddTransient<IClientLogic, ClientLogic>();
services.AddTransient<IImplementerLogic, ImplementerLogic>();
services.AddTransient<IWorkProcess, WorkModeling>();
//services.AddTransient<IComponentLogic, ComponentLogic>();
//services.AddTransient<IComputerLogic, ComputerLogic>();
//services.AddTransient<IOrderLogic, OrderLogic>();
//services.AddTransient<IReportLogic, ReportLogic>();
//services.AddTransient<IWorkProcess, WorkModeling>();
services.AddTransient<AbstractSaveToWord, SaveToWord>();
services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
////services.AddTransient<AbstractSaveToWord, SaveToWord>();
////services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
////services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
services.AddTransient<FormMain>();
services.AddTransient<FormCosmetics>();
services.AddTransient<FormCreateCosmetic>();
services.AddTransient<FormComponents>();
services.AddTransient<FormCreateOrder>();
services.AddTransient<FormComputer>();
services.AddTransient<FormComputers>();
services.AddTransient<FormComputerComponent>();
services.AddTransient<FormReportComputerComponents>();
services.AddTransient<FormReportOrders>();
services.AddTransient<FormImplementer>();
services.AddTransient<FormImplementers>();
//services.AddTransient<FormMain>();
//services.AddTransient<FormCosmetics>();
//services.AddTransient<FormCreateCosmetic>();
//services.AddTransient<FormCreateOrder>();
}
}
}