я в отлете

This commit is contained in:
Milana Ievlewa 2024-06-01 00:39:00 +04:00
parent a1bf8c4686
commit 56df693cc7
8 changed files with 191 additions and 1677 deletions

View File

@ -17,7 +17,7 @@ namespace BeautySalonDatabaseImplement
{
if (optionsBuilder.IsConfigured == false)
{
optionsBuilder.UseSqlServer(@"Data Source=ALYONA\;Initial Catalog=BeautySalonDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
optionsBuilder.UseSqlServer(@"Data Source=PRETTYNAME;Initial Catalog=BeautySalonDatabase2;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
}
base.OnConfiguring(optionsBuilder);
}

View File

@ -1,690 +0,0 @@
// <auto-generated />
using System;
using BeautySalonDatabaseImplement;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace BeautySalonDatabaseImplement.Migrations
{
[DbContext(typeof(BeautySalonDatabase))]
[Migration("20240531090628_123")]
partial class _123
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.17")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.Cosmetic", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Brand")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("CosmeticName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<double>("CosmeticPrice")
.HasColumnType("float");
b.Property<int>("LaborCostId")
.HasColumnType("int");
b.Property<int>("StorekeeperId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("LaborCostId");
b.HasIndex("StorekeeperId");
b.ToTable("Cosmetics");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.CosmeticProcedure", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("CosmeticId")
.HasColumnType("int");
b.Property<int>("Count")
.HasColumnType("int");
b.Property<int>("ProcedureId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("CosmeticId");
b.HasIndex("ProcedureId");
b.ToTable("CosmeticProcedures");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.Evaluation", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<double>("PointsCosmetics")
.HasColumnType("float");
b.Property<double>("PointsProcedure")
.HasColumnType("float");
b.Property<int>("ProcedureId")
.HasColumnType("int");
b.Property<int>("WorkerId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ProcedureId");
b.HasIndex("WorkerId");
b.ToTable("Evaluations");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.LaborCosts", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Difficulty")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("NumberHours")
.HasColumnType("int");
b.Property<int>("StorekeeperId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("StorekeeperId");
b.ToTable("LaborCosts");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.MessageInfo", b =>
{
b.Property<string>("MessageId")
.HasColumnType("nvarchar(450)");
b.Property<string>("Body")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("DateDelivery")
.HasColumnType("datetime2");
b.Property<string>("SenderName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int?>("StorekeeperId")
.HasColumnType("int");
b.Property<string>("Subject")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int?>("WorkerId")
.HasColumnType("int");
b.HasKey("MessageId");
b.HasIndex("StorekeeperId");
b.HasIndex("WorkerId");
b.ToTable("MessageInfos");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.OrderCosmetic", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("CosmeticId")
.HasColumnType("int");
b.Property<int>("OrderId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("CosmeticId");
b.HasIndex("OrderId");
b.ToTable("OrderCosmetics");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.OrderProcedure", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("OrderId")
.HasColumnType("int");
b.Property<int>("OrderProcedureCount")
.HasColumnType("int");
b.Property<int>("ProcedureId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("OrderId");
b.HasIndex("ProcedureId");
b.ToTable("OrderProcedures");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.OrderService", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("OrderId")
.HasColumnType("int");
b.Property<int>("OrderServiceCount")
.HasColumnType("int");
b.Property<int>("ServiceId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("OrderId");
b.HasIndex("ServiceId");
b.ToTable("OrderServices");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.Order_", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<DateTime>("DateCreate")
.HasColumnType("datetime2");
b.Property<DateTime?>("DateImplement")
.HasColumnType("datetime2");
b.Property<double>("OrderAmount")
.HasColumnType("float");
b.Property<int>("Status")
.HasColumnType("int");
b.Property<int>("WorkerId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("WorkerId");
b.ToTable("Orders");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.Procedure", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<double>("ProcedureDuration")
.HasColumnType("float");
b.Property<string>("ProcedureName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<double>("ProcedurePrice")
.HasColumnType("float");
b.Property<int>("WorkerId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("WorkerId");
b.ToTable("Procedures");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.Service", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ServiceName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<double>("ServicePrice")
.HasColumnType("float");
b.Property<int>("StorekeeperId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("StorekeeperId");
b.ToTable("Services");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.ServiceCosmetic", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("CosmeticId")
.HasColumnType("int");
b.Property<int>("Count")
.HasColumnType("int");
b.Property<int>("ServiceId")
.HasColumnType("int");
b.Property<int>("ServiceId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("CosmeticId");
b.HasIndex("ServiceId");
b.ToTable("ServiceCosmetics");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.ServiceProcedure", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("Count")
.HasColumnType("int");
b.Property<int>("ProcedureId")
.HasColumnType("int");
b.Property<int>("ServiceId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ProcedureId");
b.HasIndex("ServiceId");
b.ToTable("ServiceProcedures");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.Storekeeper", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Email")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("FullName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<string>("Password")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.HasKey("Id");
b.ToTable("Storekeepers");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.Worker", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Email")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<string>("FullName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<string>("Password")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.HasKey("Id");
b.ToTable("Workers");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.Cosmetic", b =>
{
b.HasOne("BeautySalonDatabaseImplement.Models.LaborCosts", "LaborCost")
.WithMany("Cosmetics")
.HasForeignKey("LaborCostId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BeautySalonDatabaseImplement.Models.Storekeeper", "Storekeeper")
.WithMany()
.HasForeignKey("StorekeeperId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("LaborCost");
b.Navigation("Storekeeper");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.CosmeticProcedure", b =>
{
b.HasOne("BeautySalonDatabaseImplement.Models.Cosmetic", "Cosmetic")
.WithMany("Procedures")
.HasForeignKey("CosmeticId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BeautySalonDatabaseImplement.Models.Procedure", "Procedure")
.WithMany("Cosmetics")
.HasForeignKey("ProcedureId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Cosmetic");
b.Navigation("Procedure");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.Evaluation", b =>
{
b.HasOne("BeautySalonDatabaseImplement.Models.Procedure", "Procedure")
.WithMany()
.HasForeignKey("ProcedureId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BeautySalonDatabaseImplement.Models.Worker", "Worker")
.WithMany()
.HasForeignKey("WorkerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Procedure");
b.Navigation("Worker");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.LaborCosts", b =>
{
b.HasOne("BeautySalonDatabaseImplement.Models.Storekeeper", "Storekeeper")
.WithMany()
.HasForeignKey("StorekeeperId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Storekeeper");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.MessageInfo", b =>
{
b.HasOne("BeautySalonDatabaseImplement.Models.Storekeeper", "Storekeeper")
.WithMany()
.HasForeignKey("StorekeeperId");
b.HasOne("BeautySalonDatabaseImplement.Models.Worker", "Worker")
.WithMany()
.HasForeignKey("WorkerId");
b.Navigation("Storekeeper");
b.Navigation("Worker");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.OrderCosmetic", b =>
{
b.HasOne("BeautySalonDatabaseImplement.Models.Cosmetic", "Cosmetic")
.WithMany()
.HasForeignKey("CosmeticId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BeautySalonDatabaseImplement.Models.Order_", "Order")
.WithMany("Cosmetics")
.HasForeignKey("OrderId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Cosmetic");
b.Navigation("Order");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.OrderProcedure", b =>
{
b.HasOne("BeautySalonDatabaseImplement.Models.Order_", "Order")
.WithMany("Procedures")
.HasForeignKey("OrderId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BeautySalonDatabaseImplement.Models.Procedure", "Procedure")
.WithMany()
.HasForeignKey("ProcedureId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Order");
b.Navigation("Procedure");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.OrderService", b =>
{
b.HasOne("BeautySalonDatabaseImplement.Models.Order_", "Order")
.WithMany("Services")
.HasForeignKey("OrderId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BeautySalonDatabaseImplement.Models.Service", "Service")
.WithMany()
.HasForeignKey("ServiceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Order");
b.Navigation("Service");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.Order_", b =>
{
b.HasOne("BeautySalonDatabaseImplement.Models.Worker", "Worker")
.WithMany()
.HasForeignKey("WorkerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Worker");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.Procedure", b =>
{
b.HasOne("BeautySalonDatabaseImplement.Models.Worker", "Worker")
.WithMany()
.HasForeignKey("WorkerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Worker");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.Service", b =>
{
b.HasOne("BeautySalonDatabaseImplement.Models.Storekeeper", "Storekeeper")
.WithMany()
.HasForeignKey("StorekeeperId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Storekeeper");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.ServiceCosmetic", b =>
{
b.HasOne("BeautySalonDatabaseImplement.Models.Cosmetic", "Cosmetic")
.WithMany()
.HasForeignKey("CosmeticId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BeautySalonDatabaseImplement.Models.Service", "Service")
.WithMany("Cosmetics")
.HasForeignKey("ServiceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Cosmetic");
b.Navigation("Service");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.ServiceProcedure", b =>
{
b.HasOne("BeautySalonDatabaseImplement.Models.Procedure", "Procedure")
.WithMany()
.HasForeignKey("ProcedureId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BeautySalonDatabaseImplement.Models.Service", "Service")
.WithMany("Procedures")
.HasForeignKey("ServiceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Procedure");
b.Navigation("Service");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.Cosmetic", b =>
{
b.Navigation("Procedures");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.LaborCosts", b =>
{
b.Navigation("Cosmetics");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.Order_", b =>
{
b.Navigation("Cosmetics");
b.Navigation("Procedures");
b.Navigation("Services");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.Procedure", b =>
{
b.Navigation("Cosmetics");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.Service", b =>
{
b.Navigation("Cosmetics");
b.Navigation("Procedures");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -1,687 +0,0 @@
// <auto-generated />
using System;
using BeautySalonDatabaseImplement;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace BeautySalonDatabaseImplement.Migrations
{
[DbContext(typeof(BeautySalonDatabase))]
[Migration("20240531143301_aaa")]
partial class aaa
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.17")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.Cosmetic", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Brand")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("CosmeticName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<double>("CosmeticPrice")
.HasColumnType("float");
b.Property<int>("LaborCostId")
.HasColumnType("int");
b.Property<int>("StorekeeperId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("LaborCostId");
b.HasIndex("StorekeeperId");
b.ToTable("Cosmetics");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.CosmeticProcedure", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("CosmeticId")
.HasColumnType("int");
b.Property<int>("Count")
.HasColumnType("int");
b.Property<int>("ProcedureId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("CosmeticId");
b.HasIndex("ProcedureId");
b.ToTable("CosmeticProcedures");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.Evaluation", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<double>("PointsCosmetics")
.HasColumnType("float");
b.Property<double>("PointsProcedure")
.HasColumnType("float");
b.Property<int>("ProcedureId")
.HasColumnType("int");
b.Property<int>("WorkerId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ProcedureId");
b.HasIndex("WorkerId");
b.ToTable("Evaluations");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.LaborCosts", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Difficulty")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("NumberHours")
.HasColumnType("int");
b.Property<int>("StorekeeperId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("StorekeeperId");
b.ToTable("LaborCosts");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.MessageInfo", b =>
{
b.Property<string>("MessageId")
.HasColumnType("nvarchar(450)");
b.Property<string>("Body")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("DateDelivery")
.HasColumnType("datetime2");
b.Property<string>("SenderName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int?>("StorekeeperId")
.HasColumnType("int");
b.Property<string>("Subject")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int?>("WorkerId")
.HasColumnType("int");
b.HasKey("MessageId");
b.HasIndex("StorekeeperId");
b.HasIndex("WorkerId");
b.ToTable("MessageInfos");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.OrderCosmetic", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("CosmeticId")
.HasColumnType("int");
b.Property<int>("OrderId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("CosmeticId");
b.HasIndex("OrderId");
b.ToTable("OrderCosmetics");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.OrderProcedure", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("OrderId")
.HasColumnType("int");
b.Property<int>("OrderProcedureCount")
.HasColumnType("int");
b.Property<int>("ProcedureId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("OrderId");
b.HasIndex("ProcedureId");
b.ToTable("OrderProcedures");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.OrderService", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("OrderId")
.HasColumnType("int");
b.Property<int>("OrderServiceCount")
.HasColumnType("int");
b.Property<int>("ServiceId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("OrderId");
b.HasIndex("ServiceId");
b.ToTable("OrderServices");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.Order_", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<DateTime>("DateCreate")
.HasColumnType("datetime2");
b.Property<DateTime?>("DateImplement")
.HasColumnType("datetime2");
b.Property<double>("OrderAmount")
.HasColumnType("float");
b.Property<int>("Status")
.HasColumnType("int");
b.Property<int>("WorkerId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("WorkerId");
b.ToTable("Orders");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.Procedure", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<double>("ProcedureDuration")
.HasColumnType("float");
b.Property<string>("ProcedureName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<double>("ProcedurePrice")
.HasColumnType("float");
b.Property<int>("WorkerId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("WorkerId");
b.ToTable("Procedures");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.Service", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ServiceName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<double>("ServicePrice")
.HasColumnType("float");
b.Property<int>("StorekeeperId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("StorekeeperId");
b.ToTable("Services");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.ServiceCosmetic", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("CosmeticId")
.HasColumnType("int");
b.Property<int>("Count")
.HasColumnType("int");
b.Property<int>("ServiceId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("CosmeticId");
b.HasIndex("ServiceId");
b.ToTable("ServiceCosmetics");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.ServiceProcedure", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("Count")
.HasColumnType("int");
b.Property<int>("ProcedureId")
.HasColumnType("int");
b.Property<int>("ServiceId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ProcedureId");
b.HasIndex("ServiceId");
b.ToTable("ServiceProcedures");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.Storekeeper", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Email")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("FullName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<string>("Password")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.HasKey("Id");
b.ToTable("Storekeepers");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.Worker", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Email")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<string>("FullName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<string>("Password")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.HasKey("Id");
b.ToTable("Workers");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.Cosmetic", b =>
{
b.HasOne("BeautySalonDatabaseImplement.Models.LaborCosts", "LaborCost")
.WithMany("Cosmetics")
.HasForeignKey("LaborCostId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BeautySalonDatabaseImplement.Models.Storekeeper", "Storekeeper")
.WithMany()
.HasForeignKey("StorekeeperId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("LaborCost");
b.Navigation("Storekeeper");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.CosmeticProcedure", b =>
{
b.HasOne("BeautySalonDatabaseImplement.Models.Cosmetic", "Cosmetic")
.WithMany("Procedures")
.HasForeignKey("CosmeticId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BeautySalonDatabaseImplement.Models.Procedure", "Procedure")
.WithMany("Cosmetics")
.HasForeignKey("ProcedureId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Cosmetic");
b.Navigation("Procedure");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.Evaluation", b =>
{
b.HasOne("BeautySalonDatabaseImplement.Models.Procedure", "Procedure")
.WithMany()
.HasForeignKey("ProcedureId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BeautySalonDatabaseImplement.Models.Worker", "Worker")
.WithMany()
.HasForeignKey("WorkerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Procedure");
b.Navigation("Worker");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.LaborCosts", b =>
{
b.HasOne("BeautySalonDatabaseImplement.Models.Storekeeper", "Storekeeper")
.WithMany()
.HasForeignKey("StorekeeperId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Storekeeper");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.MessageInfo", b =>
{
b.HasOne("BeautySalonDatabaseImplement.Models.Storekeeper", "Storekeeper")
.WithMany()
.HasForeignKey("StorekeeperId");
b.HasOne("BeautySalonDatabaseImplement.Models.Worker", "Worker")
.WithMany()
.HasForeignKey("WorkerId");
b.Navigation("Storekeeper");
b.Navigation("Worker");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.OrderCosmetic", b =>
{
b.HasOne("BeautySalonDatabaseImplement.Models.Cosmetic", "Cosmetic")
.WithMany()
.HasForeignKey("CosmeticId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BeautySalonDatabaseImplement.Models.Order_", "Order")
.WithMany("Cosmetics")
.HasForeignKey("OrderId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Cosmetic");
b.Navigation("Order");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.OrderProcedure", b =>
{
b.HasOne("BeautySalonDatabaseImplement.Models.Order_", "Order")
.WithMany("Procedures")
.HasForeignKey("OrderId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BeautySalonDatabaseImplement.Models.Procedure", "Procedure")
.WithMany()
.HasForeignKey("ProcedureId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Order");
b.Navigation("Procedure");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.OrderService", b =>
{
b.HasOne("BeautySalonDatabaseImplement.Models.Order_", "Order")
.WithMany("Services")
.HasForeignKey("OrderId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BeautySalonDatabaseImplement.Models.Service", "Service")
.WithMany()
.HasForeignKey("ServiceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Order");
b.Navigation("Service");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.Order_", b =>
{
b.HasOne("BeautySalonDatabaseImplement.Models.Worker", "Worker")
.WithMany()
.HasForeignKey("WorkerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Worker");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.Procedure", b =>
{
b.HasOne("BeautySalonDatabaseImplement.Models.Worker", "Worker")
.WithMany()
.HasForeignKey("WorkerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Worker");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.Service", b =>
{
b.HasOne("BeautySalonDatabaseImplement.Models.Storekeeper", "Storekeeper")
.WithMany()
.HasForeignKey("StorekeeperId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Storekeeper");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.ServiceCosmetic", b =>
{
b.HasOne("BeautySalonDatabaseImplement.Models.Cosmetic", "Cosmetic")
.WithMany()
.HasForeignKey("CosmeticId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BeautySalonDatabaseImplement.Models.Service", "Service")
.WithMany("Cosmetics")
.HasForeignKey("ServiceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Cosmetic");
b.Navigation("Service");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.ServiceProcedure", b =>
{
b.HasOne("BeautySalonDatabaseImplement.Models.Procedure", "Procedure")
.WithMany()
.HasForeignKey("ProcedureId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BeautySalonDatabaseImplement.Models.Service", "Service")
.WithMany("Procedures")
.HasForeignKey("ServiceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Procedure");
b.Navigation("Service");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.Cosmetic", b =>
{
b.Navigation("Procedures");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.LaborCosts", b =>
{
b.Navigation("Cosmetics");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.Order_", b =>
{
b.Navigation("Cosmetics");
b.Navigation("Procedures");
b.Navigation("Services");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.Procedure", b =>
{
b.Navigation("Cosmetics");
});
modelBuilder.Entity("BeautySalonDatabaseImplement.Models.Service", b =>
{
b.Navigation("Cosmetics");
b.Navigation("Procedures");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -1,22 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BeautySalonDatabaseImplement.Migrations
{
/// <inheritdoc />
public partial class aaa : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}

View File

@ -1,112 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BeautySalonDatabaseImplement.Migrations
{
/// <inheritdoc />
public partial class HZmigration : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Evaluations_Procedures_ProcedureId",
table: "Evaluations");
migrationBuilder.DropIndex(
name: "IX_Evaluations_ProcedureId",
table: "Evaluations");
migrationBuilder.AddColumn<int>(
name: "EvaluationId",
table: "Procedures",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.CreateTable(
name: "ProcedureCosmetics",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
CosmeticId = table.Column<int>(type: "int", nullable: false),
ProcedureId = table.Column<int>(type: "int", nullable: false),
Count = table.Column<int>(type: "int", 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_Procedures_EvaluationId",
table: "Procedures",
column: "EvaluationId",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_ProcedureCosmetics_CosmeticId",
table: "ProcedureCosmetics",
column: "CosmeticId");
migrationBuilder.CreateIndex(
name: "IX_ProcedureCosmetics_ProcedureId",
table: "ProcedureCosmetics",
column: "ProcedureId");
migrationBuilder.AddForeignKey(
name: "FK_Procedures_Evaluations_EvaluationId",
table: "Procedures",
column: "EvaluationId",
principalTable: "Evaluations",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Procedures_Evaluations_EvaluationId",
table: "Procedures");
migrationBuilder.DropTable(
name: "ProcedureCosmetics");
migrationBuilder.DropIndex(
name: "IX_Procedures_EvaluationId",
table: "Procedures");
migrationBuilder.DropColumn(
name: "EvaluationId",
table: "Procedures");
migrationBuilder.CreateIndex(
name: "IX_Evaluations_ProcedureId",
table: "Evaluations",
column: "ProcedureId");
migrationBuilder.AddForeignKey(
name: "FK_Evaluations_Procedures_ProcedureId",
table: "Evaluations",
column: "ProcedureId",
principalTable: "Procedures",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
}

View File

@ -12,8 +12,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace BeautySalonDatabaseImplement.Migrations
{
[DbContext(typeof(BeautySalonDatabase))]
[Migration("20240531181713_HZmigration")]
partial class HZmigration
[Migration("20240531194041_mig")]
partial class mig
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)

View File

@ -6,7 +6,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
namespace BeautySalonDatabaseImplement.Migrations
{
/// <inheritdoc />
public partial class _123 : Migration
public partial class mig : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
@ -83,6 +83,28 @@ namespace BeautySalonDatabaseImplement.Migrations
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Evaluations",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
PointsProcedure = table.Column<double>(type: "float", nullable: false),
PointsCosmetics = table.Column<double>(type: "float", nullable: false),
ProcedureId = table.Column<int>(type: "int", nullable: false),
WorkerId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Evaluations", x => x.Id);
table.ForeignKey(
name: "FK_Evaluations_Workers_WorkerId",
column: x => x.WorkerId,
principalTable: "Workers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "MessageInfos",
columns: table => new
@ -133,28 +155,6 @@ namespace BeautySalonDatabaseImplement.Migrations
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Procedures",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
ProcedureName = table.Column<string>(type: "nvarchar(max)", nullable: false),
ProcedurePrice = table.Column<double>(type: "float", nullable: false),
ProcedureDuration = table.Column<double>(type: "float", nullable: false),
WorkerId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Procedures", x => x.Id);
table.ForeignKey(
name: "FK_Procedures_Workers_WorkerId",
column: x => x.WorkerId,
principalTable: "Workers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Cosmetics",
columns: table => new
@ -184,6 +184,35 @@ namespace BeautySalonDatabaseImplement.Migrations
onDelete: ReferentialAction.NoAction);
});
migrationBuilder.CreateTable(
name: "Procedures",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
ProcedureName = table.Column<string>(type: "nvarchar(max)", nullable: false),
ProcedurePrice = table.Column<double>(type: "float", nullable: false),
ProcedureDuration = table.Column<double>(type: "float", nullable: false),
WorkerId = table.Column<int>(type: "int", nullable: false),
EvaluationId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Procedures", x => x.Id);
table.ForeignKey(
name: "FK_Procedures_Evaluations_EvaluationId",
column: x => x.EvaluationId,
principalTable: "Evaluations",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Procedures_Workers_WorkerId",
column: x => x.WorkerId,
principalTable: "Workers",
principalColumn: "Id",
onDelete: ReferentialAction.NoAction);
});
migrationBuilder.CreateTable(
name: "OrderServices",
columns: table => new
@ -211,115 +240,6 @@ namespace BeautySalonDatabaseImplement.Migrations
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Evaluations",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
PointsProcedure = table.Column<double>(type: "float", nullable: false),
PointsCosmetics = table.Column<double>(type: "float", nullable: false),
ProcedureId = table.Column<int>(type: "int", nullable: false),
WorkerId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Evaluations", x => x.Id);
table.ForeignKey(
name: "FK_Evaluations_Procedures_ProcedureId",
column: x => x.ProcedureId,
principalTable: "Procedures",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Evaluations_Workers_WorkerId",
column: x => x.WorkerId,
principalTable: "Workers",
principalColumn: "Id",
onDelete: ReferentialAction.NoAction);
});
migrationBuilder.CreateTable(
name: "OrderProcedures",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
OrderId = table.Column<int>(type: "int", nullable: false),
ProcedureId = table.Column<int>(type: "int", nullable: false),
OrderProcedureCount = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_OrderProcedures", x => x.Id);
table.ForeignKey(
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.NoAction);
});
migrationBuilder.CreateTable(
name: "ServiceProcedures",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
ServiceId = table.Column<int>(type: "int", nullable: false),
ProcedureId = table.Column<int>(type: "int", nullable: false),
Count = table.Column<int>(type: "int", 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: "CosmeticProcedures",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
CosmeticId = table.Column<int>(type: "int", nullable: false),
ProcedureId = table.Column<int>(type: "int", nullable: false),
Count = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CosmeticProcedures", x => x.Id);
table.ForeignKey(
name: "FK_CosmeticProcedures_Cosmetics_CosmeticId",
column: x => x.CosmeticId,
principalTable: "Cosmetics",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_CosmeticProcedures_Procedures_ProcedureId",
column: x => x.ProcedureId,
principalTable: "Procedures",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "OrderCosmetics",
columns: table => new
@ -354,7 +274,7 @@ namespace BeautySalonDatabaseImplement.Migrations
.Annotation("SqlServer:Identity", "1, 1"),
CosmeticId = table.Column<int>(type: "int", nullable: false),
ServiceId = table.Column<int>(type: "int", nullable: false),
Count = table.Column<int>(type: "int", nullable: false),
Count = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
@ -373,6 +293,114 @@ namespace BeautySalonDatabaseImplement.Migrations
onDelete: ReferentialAction.NoAction);
});
migrationBuilder.CreateTable(
name: "CosmeticProcedures",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
CosmeticId = table.Column<int>(type: "int", nullable: false),
ProcedureId = table.Column<int>(type: "int", nullable: false),
Count = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CosmeticProcedures", x => x.Id);
table.ForeignKey(
name: "FK_CosmeticProcedures_Cosmetics_CosmeticId",
column: x => x.CosmeticId,
principalTable: "Cosmetics",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_CosmeticProcedures_Procedures_ProcedureId",
column: x => x.ProcedureId,
principalTable: "Procedures",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "OrderProcedures",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
OrderId = table.Column<int>(type: "int", nullable: false),
ProcedureId = table.Column<int>(type: "int", nullable: false),
OrderProcedureCount = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_OrderProcedures", x => x.Id);
table.ForeignKey(
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.NoAction);
});
migrationBuilder.CreateTable(
name: "ProcedureCosmetics",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
CosmeticId = table.Column<int>(type: "int", nullable: false),
ProcedureId = table.Column<int>(type: "int", nullable: false),
Count = table.Column<int>(type: "int", 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.CreateTable(
name: "ServiceProcedures",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
ServiceId = table.Column<int>(type: "int", nullable: false),
ProcedureId = table.Column<int>(type: "int", nullable: false),
Count = table.Column<int>(type: "int", 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.CreateIndex(
name: "IX_CosmeticProcedures_CosmeticId",
table: "CosmeticProcedures",
@ -393,11 +421,6 @@ namespace BeautySalonDatabaseImplement.Migrations
table: "Cosmetics",
column: "StorekeeperId");
migrationBuilder.CreateIndex(
name: "IX_Evaluations_ProcedureId",
table: "Evaluations",
column: "ProcedureId");
migrationBuilder.CreateIndex(
name: "IX_Evaluations_WorkerId",
table: "Evaluations",
@ -453,6 +476,22 @@ namespace BeautySalonDatabaseImplement.Migrations
table: "OrderServices",
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_EvaluationId",
table: "Procedures",
column: "EvaluationId",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Procedures_WorkerId",
table: "Procedures",
@ -490,9 +529,6 @@ namespace BeautySalonDatabaseImplement.Migrations
migrationBuilder.DropTable(
name: "CosmeticProcedures");
migrationBuilder.DropTable(
name: "Evaluations");
migrationBuilder.DropTable(
name: "MessageInfos");
@ -505,6 +541,9 @@ namespace BeautySalonDatabaseImplement.Migrations
migrationBuilder.DropTable(
name: "OrderServices");
migrationBuilder.DropTable(
name: "ProcedureCosmetics");
migrationBuilder.DropTable(
name: "ServiceCosmetics");
@ -527,10 +566,13 @@ namespace BeautySalonDatabaseImplement.Migrations
name: "LaborCosts");
migrationBuilder.DropTable(
name: "Workers");
name: "Evaluations");
migrationBuilder.DropTable(
name: "Storekeepers");
migrationBuilder.DropTable(
name: "Workers");
}
}
}

View File

@ -150,35 +150,18 @@ namespace StorekeeperWebApp.Controllers
APIStorekeeper.Storekeeper = null;
Response.Redirect("Enter");
}
[HttpGet]
public IActionResult Reports()
{
if (APIStorekeeper.Storekeeper == null)
{
return Redirect("~/Home/Enter");
}
ViewBag.Cosmetics = _cosmeticLogic.ReadList(new CosmeticSearchModel());
return View();
}
[HttpPost]
public IActionResult Reports(DateTime dateFrom, DateTime dateTo)
{
if (APIStorekeeper.Storekeeper == null)
{
throw new Exception("Необходимо авторизоваться!");
}
if (dateFrom == DateTime.MinValue || dateTo == DateTime.MinValue)
{
throw new Exception("Введены не все данные!");
}
ViewBag.Cosmetics = _cosmeticLogic.ReadList(new CosmeticSearchModel());
var data = _reportLogic.GetServices(new ReportServiceBindingModel
{
DateFrom = dateFrom,
DateTo = dateTo
});
var data = _reportLogic.GetServices(new ReportServiceBindingModel());
ViewBag.Cosmetic = _cosmeticLogic.ReadList(new CosmeticSearchModel());