diff --git a/BeautySalonView/BeautySalonDatabaseImplement/BeautySalonDatabase.cs b/BeautySalonView/BeautySalonDatabaseImplement/BeautySalonDatabase.cs index 87da54c..e59352d 100644 --- a/BeautySalonView/BeautySalonDatabaseImplement/BeautySalonDatabase.cs +++ b/BeautySalonView/BeautySalonDatabaseImplement/BeautySalonDatabase.cs @@ -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); } diff --git a/BeautySalonView/BeautySalonDatabaseImplement/Migrations/20240531090628_123.Designer.cs b/BeautySalonView/BeautySalonDatabaseImplement/Migrations/20240531090628_123.Designer.cs deleted file mode 100644 index af6029f..0000000 --- a/BeautySalonView/BeautySalonDatabaseImplement/Migrations/20240531090628_123.Designer.cs +++ /dev/null @@ -1,690 +0,0 @@ -// -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 - { - /// - 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("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Brand") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("CosmeticName") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("CosmeticPrice") - .HasColumnType("float"); - - b.Property("LaborCostId") - .HasColumnType("int"); - - b.Property("StorekeeperId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("LaborCostId"); - - b.HasIndex("StorekeeperId"); - - b.ToTable("Cosmetics"); - }); - - modelBuilder.Entity("BeautySalonDatabaseImplement.Models.CosmeticProcedure", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("CosmeticId") - .HasColumnType("int"); - - b.Property("Count") - .HasColumnType("int"); - - b.Property("ProcedureId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("CosmeticId"); - - b.HasIndex("ProcedureId"); - - b.ToTable("CosmeticProcedures"); - }); - - modelBuilder.Entity("BeautySalonDatabaseImplement.Models.Evaluation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("PointsCosmetics") - .HasColumnType("float"); - - b.Property("PointsProcedure") - .HasColumnType("float"); - - b.Property("ProcedureId") - .HasColumnType("int"); - - b.Property("WorkerId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("ProcedureId"); - - b.HasIndex("WorkerId"); - - b.ToTable("Evaluations"); - }); - - modelBuilder.Entity("BeautySalonDatabaseImplement.Models.LaborCosts", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Difficulty") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("NumberHours") - .HasColumnType("int"); - - b.Property("StorekeeperId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("StorekeeperId"); - - b.ToTable("LaborCosts"); - }); - - modelBuilder.Entity("BeautySalonDatabaseImplement.Models.MessageInfo", b => - { - b.Property("MessageId") - .HasColumnType("nvarchar(450)"); - - b.Property("Body") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("DateDelivery") - .HasColumnType("datetime2"); - - b.Property("SenderName") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("StorekeeperId") - .HasColumnType("int"); - - b.Property("Subject") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("WorkerId") - .HasColumnType("int"); - - b.HasKey("MessageId"); - - b.HasIndex("StorekeeperId"); - - b.HasIndex("WorkerId"); - - b.ToTable("MessageInfos"); - }); - - modelBuilder.Entity("BeautySalonDatabaseImplement.Models.OrderCosmetic", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("CosmeticId") - .HasColumnType("int"); - - b.Property("OrderId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("CosmeticId"); - - b.HasIndex("OrderId"); - - b.ToTable("OrderCosmetics"); - }); - - modelBuilder.Entity("BeautySalonDatabaseImplement.Models.OrderProcedure", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("OrderId") - .HasColumnType("int"); - - b.Property("OrderProcedureCount") - .HasColumnType("int"); - - b.Property("ProcedureId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("OrderId"); - - b.HasIndex("ProcedureId"); - - b.ToTable("OrderProcedures"); - }); - - modelBuilder.Entity("BeautySalonDatabaseImplement.Models.OrderService", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("OrderId") - .HasColumnType("int"); - - b.Property("OrderServiceCount") - .HasColumnType("int"); - - b.Property("ServiceId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("OrderId"); - - b.HasIndex("ServiceId"); - - b.ToTable("OrderServices"); - }); - - modelBuilder.Entity("BeautySalonDatabaseImplement.Models.Order_", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("DateCreate") - .HasColumnType("datetime2"); - - b.Property("DateImplement") - .HasColumnType("datetime2"); - - b.Property("OrderAmount") - .HasColumnType("float"); - - b.Property("Status") - .HasColumnType("int"); - - b.Property("WorkerId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("WorkerId"); - - b.ToTable("Orders"); - }); - - modelBuilder.Entity("BeautySalonDatabaseImplement.Models.Procedure", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ProcedureDuration") - .HasColumnType("float"); - - b.Property("ProcedureName") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ProcedurePrice") - .HasColumnType("float"); - - b.Property("WorkerId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("WorkerId"); - - b.ToTable("Procedures"); - }); - - modelBuilder.Entity("BeautySalonDatabaseImplement.Models.Service", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ServiceName") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ServicePrice") - .HasColumnType("float"); - - b.Property("StorekeeperId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("StorekeeperId"); - - b.ToTable("Services"); - }); - - modelBuilder.Entity("BeautySalonDatabaseImplement.Models.ServiceCosmetic", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("CosmeticId") - .HasColumnType("int"); - - b.Property("Count") - .HasColumnType("int"); - - b.Property("ServiceId") - .HasColumnType("int"); - - b.Property("ServiceId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("CosmeticId"); - - b.HasIndex("ServiceId"); - - b.ToTable("ServiceCosmetics"); - }); - - modelBuilder.Entity("BeautySalonDatabaseImplement.Models.ServiceProcedure", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Count") - .HasColumnType("int"); - - b.Property("ProcedureId") - .HasColumnType("int"); - - b.Property("ServiceId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("ProcedureId"); - - b.HasIndex("ServiceId"); - - b.ToTable("ServiceProcedures"); - }); - - modelBuilder.Entity("BeautySalonDatabaseImplement.Models.Storekeeper", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Email") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("Password") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.HasKey("Id"); - - b.ToTable("Storekeepers"); - }); - - modelBuilder.Entity("BeautySalonDatabaseImplement.Models.Worker", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Email") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("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 - } - } -} diff --git a/BeautySalonView/BeautySalonDatabaseImplement/Migrations/20240531143301_aaa.Designer.cs b/BeautySalonView/BeautySalonDatabaseImplement/Migrations/20240531143301_aaa.Designer.cs deleted file mode 100644 index 50075c9..0000000 --- a/BeautySalonView/BeautySalonDatabaseImplement/Migrations/20240531143301_aaa.Designer.cs +++ /dev/null @@ -1,687 +0,0 @@ -// -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 - { - /// - 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("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Brand") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("CosmeticName") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("CosmeticPrice") - .HasColumnType("float"); - - b.Property("LaborCostId") - .HasColumnType("int"); - - b.Property("StorekeeperId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("LaborCostId"); - - b.HasIndex("StorekeeperId"); - - b.ToTable("Cosmetics"); - }); - - modelBuilder.Entity("BeautySalonDatabaseImplement.Models.CosmeticProcedure", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("CosmeticId") - .HasColumnType("int"); - - b.Property("Count") - .HasColumnType("int"); - - b.Property("ProcedureId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("CosmeticId"); - - b.HasIndex("ProcedureId"); - - b.ToTable("CosmeticProcedures"); - }); - - modelBuilder.Entity("BeautySalonDatabaseImplement.Models.Evaluation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("PointsCosmetics") - .HasColumnType("float"); - - b.Property("PointsProcedure") - .HasColumnType("float"); - - b.Property("ProcedureId") - .HasColumnType("int"); - - b.Property("WorkerId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("ProcedureId"); - - b.HasIndex("WorkerId"); - - b.ToTable("Evaluations"); - }); - - modelBuilder.Entity("BeautySalonDatabaseImplement.Models.LaborCosts", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Difficulty") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("NumberHours") - .HasColumnType("int"); - - b.Property("StorekeeperId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("StorekeeperId"); - - b.ToTable("LaborCosts"); - }); - - modelBuilder.Entity("BeautySalonDatabaseImplement.Models.MessageInfo", b => - { - b.Property("MessageId") - .HasColumnType("nvarchar(450)"); - - b.Property("Body") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("DateDelivery") - .HasColumnType("datetime2"); - - b.Property("SenderName") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("StorekeeperId") - .HasColumnType("int"); - - b.Property("Subject") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("WorkerId") - .HasColumnType("int"); - - b.HasKey("MessageId"); - - b.HasIndex("StorekeeperId"); - - b.HasIndex("WorkerId"); - - b.ToTable("MessageInfos"); - }); - - modelBuilder.Entity("BeautySalonDatabaseImplement.Models.OrderCosmetic", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("CosmeticId") - .HasColumnType("int"); - - b.Property("OrderId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("CosmeticId"); - - b.HasIndex("OrderId"); - - b.ToTable("OrderCosmetics"); - }); - - modelBuilder.Entity("BeautySalonDatabaseImplement.Models.OrderProcedure", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("OrderId") - .HasColumnType("int"); - - b.Property("OrderProcedureCount") - .HasColumnType("int"); - - b.Property("ProcedureId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("OrderId"); - - b.HasIndex("ProcedureId"); - - b.ToTable("OrderProcedures"); - }); - - modelBuilder.Entity("BeautySalonDatabaseImplement.Models.OrderService", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("OrderId") - .HasColumnType("int"); - - b.Property("OrderServiceCount") - .HasColumnType("int"); - - b.Property("ServiceId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("OrderId"); - - b.HasIndex("ServiceId"); - - b.ToTable("OrderServices"); - }); - - modelBuilder.Entity("BeautySalonDatabaseImplement.Models.Order_", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("DateCreate") - .HasColumnType("datetime2"); - - b.Property("DateImplement") - .HasColumnType("datetime2"); - - b.Property("OrderAmount") - .HasColumnType("float"); - - b.Property("Status") - .HasColumnType("int"); - - b.Property("WorkerId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("WorkerId"); - - b.ToTable("Orders"); - }); - - modelBuilder.Entity("BeautySalonDatabaseImplement.Models.Procedure", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ProcedureDuration") - .HasColumnType("float"); - - b.Property("ProcedureName") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ProcedurePrice") - .HasColumnType("float"); - - b.Property("WorkerId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("WorkerId"); - - b.ToTable("Procedures"); - }); - - modelBuilder.Entity("BeautySalonDatabaseImplement.Models.Service", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ServiceName") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ServicePrice") - .HasColumnType("float"); - - b.Property("StorekeeperId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("StorekeeperId"); - - b.ToTable("Services"); - }); - - modelBuilder.Entity("BeautySalonDatabaseImplement.Models.ServiceCosmetic", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("CosmeticId") - .HasColumnType("int"); - - b.Property("Count") - .HasColumnType("int"); - - b.Property("ServiceId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("CosmeticId"); - - b.HasIndex("ServiceId"); - - b.ToTable("ServiceCosmetics"); - }); - - modelBuilder.Entity("BeautySalonDatabaseImplement.Models.ServiceProcedure", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Count") - .HasColumnType("int"); - - b.Property("ProcedureId") - .HasColumnType("int"); - - b.Property("ServiceId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("ProcedureId"); - - b.HasIndex("ServiceId"); - - b.ToTable("ServiceProcedures"); - }); - - modelBuilder.Entity("BeautySalonDatabaseImplement.Models.Storekeeper", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Email") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("Password") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.HasKey("Id"); - - b.ToTable("Storekeepers"); - }); - - modelBuilder.Entity("BeautySalonDatabaseImplement.Models.Worker", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Email") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("FullName") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("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 - } - } -} diff --git a/BeautySalonView/BeautySalonDatabaseImplement/Migrations/20240531143301_aaa.cs b/BeautySalonView/BeautySalonDatabaseImplement/Migrations/20240531143301_aaa.cs deleted file mode 100644 index 1163f84..0000000 --- a/BeautySalonView/BeautySalonDatabaseImplement/Migrations/20240531143301_aaa.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace BeautySalonDatabaseImplement.Migrations -{ - /// - public partial class aaa : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - - } - } -} diff --git a/BeautySalonView/BeautySalonDatabaseImplement/Migrations/20240531181713_HZmigration.cs b/BeautySalonView/BeautySalonDatabaseImplement/Migrations/20240531181713_HZmigration.cs deleted file mode 100644 index a0a2010..0000000 --- a/BeautySalonView/BeautySalonDatabaseImplement/Migrations/20240531181713_HZmigration.cs +++ /dev/null @@ -1,112 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace BeautySalonDatabaseImplement.Migrations -{ - /// - public partial class HZmigration : Migration - { - /// - 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( - name: "EvaluationId", - table: "Procedures", - type: "int", - nullable: false, - defaultValue: 0); - - migrationBuilder.CreateTable( - name: "ProcedureCosmetics", - columns: table => new - { - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - CosmeticId = table.Column(type: "int", nullable: false), - ProcedureId = table.Column(type: "int", nullable: false), - Count = table.Column(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); - } - - /// - 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); - } - } -} diff --git a/BeautySalonView/BeautySalonDatabaseImplement/Migrations/20240531181713_HZmigration.Designer.cs b/BeautySalonView/BeautySalonDatabaseImplement/Migrations/20240531194041_mig.Designer.cs similarity index 99% rename from BeautySalonView/BeautySalonDatabaseImplement/Migrations/20240531181713_HZmigration.Designer.cs rename to BeautySalonView/BeautySalonDatabaseImplement/Migrations/20240531194041_mig.Designer.cs index d2be27e..7ae9009 100644 --- a/BeautySalonView/BeautySalonDatabaseImplement/Migrations/20240531181713_HZmigration.Designer.cs +++ b/BeautySalonView/BeautySalonDatabaseImplement/Migrations/20240531194041_mig.Designer.cs @@ -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 { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) diff --git a/BeautySalonView/BeautySalonDatabaseImplement/Migrations/20240531090628_123.cs b/BeautySalonView/BeautySalonDatabaseImplement/Migrations/20240531194041_mig.cs similarity index 91% rename from BeautySalonView/BeautySalonDatabaseImplement/Migrations/20240531090628_123.cs rename to BeautySalonView/BeautySalonDatabaseImplement/Migrations/20240531194041_mig.cs index 9190210..2f0383b 100644 --- a/BeautySalonView/BeautySalonDatabaseImplement/Migrations/20240531090628_123.cs +++ b/BeautySalonView/BeautySalonDatabaseImplement/Migrations/20240531194041_mig.cs @@ -6,7 +6,7 @@ using Microsoft.EntityFrameworkCore.Migrations; namespace BeautySalonDatabaseImplement.Migrations { /// - public partial class _123 : Migration + public partial class mig : Migration { /// 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(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + PointsProcedure = table.Column(type: "float", nullable: false), + PointsCosmetics = table.Column(type: "float", nullable: false), + ProcedureId = table.Column(type: "int", nullable: false), + WorkerId = table.Column(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(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - ProcedureName = table.Column(type: "nvarchar(max)", nullable: false), - ProcedurePrice = table.Column(type: "float", nullable: false), - ProcedureDuration = table.Column(type: "float", nullable: false), - WorkerId = table.Column(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(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + ProcedureName = table.Column(type: "nvarchar(max)", nullable: false), + ProcedurePrice = table.Column(type: "float", nullable: false), + ProcedureDuration = table.Column(type: "float", nullable: false), + WorkerId = table.Column(type: "int", nullable: false), + EvaluationId = table.Column(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(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - PointsProcedure = table.Column(type: "float", nullable: false), - PointsCosmetics = table.Column(type: "float", nullable: false), - ProcedureId = table.Column(type: "int", nullable: false), - WorkerId = table.Column(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(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - OrderId = table.Column(type: "int", nullable: false), - ProcedureId = table.Column(type: "int", nullable: false), - OrderProcedureCount = table.Column(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(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - ServiceId = table.Column(type: "int", nullable: false), - ProcedureId = table.Column(type: "int", nullable: false), - Count = table.Column(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(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - CosmeticId = table.Column(type: "int", nullable: false), - ProcedureId = table.Column(type: "int", nullable: false), - Count = table.Column(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(type: "int", nullable: false), ServiceId = table.Column(type: "int", nullable: false), - Count = table.Column(type: "int", nullable: false), + Count = table.Column(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(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + CosmeticId = table.Column(type: "int", nullable: false), + ProcedureId = table.Column(type: "int", nullable: false), + Count = table.Column(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(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + OrderId = table.Column(type: "int", nullable: false), + ProcedureId = table.Column(type: "int", nullable: false), + OrderProcedureCount = table.Column(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(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + CosmeticId = table.Column(type: "int", nullable: false), + ProcedureId = table.Column(type: "int", nullable: false), + Count = table.Column(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(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + ServiceId = table.Column(type: "int", nullable: false), + ProcedureId = table.Column(type: "int", nullable: false), + Count = table.Column(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"); } } } diff --git a/BeautySalonView/StaffMemberWebApp/Controllers/HomeController.cs b/BeautySalonView/StaffMemberWebApp/Controllers/HomeController.cs index 450d861..d77fe1f 100644 --- a/BeautySalonView/StaffMemberWebApp/Controllers/HomeController.cs +++ b/BeautySalonView/StaffMemberWebApp/Controllers/HomeController.cs @@ -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());