diff --git a/Confectionery/ConfectioneryContracts/BindingModels/MessageInfoBindingModel.cs b/Confectionery/ConfectioneryContracts/BindingModels/MessageInfoBindingModel.cs index 85b4c39..a84be8c 100644 --- a/Confectionery/ConfectioneryContracts/BindingModels/MessageInfoBindingModel.cs +++ b/Confectionery/ConfectioneryContracts/BindingModels/MessageInfoBindingModel.cs @@ -15,5 +15,7 @@ namespace ConfectioneryContracts.BindingModels public DateTime DateDelivery { get; set; } public string Subject { get; set; } = string.Empty; public string Body { get; set; } = string.Empty; + + public int Id { get; set; } } } diff --git a/Confectionery/ConfectioneryContracts/ViewModels/MessageInfoViewModel.cs b/Confectionery/ConfectioneryContracts/ViewModels/MessageInfoViewModel.cs index 0972e21..863604f 100644 --- a/Confectionery/ConfectioneryContracts/ViewModels/MessageInfoViewModel.cs +++ b/Confectionery/ConfectioneryContracts/ViewModels/MessageInfoViewModel.cs @@ -23,5 +23,7 @@ namespace ConfectioneryContracts.ViewModels public string Subject { get; set; } = string.Empty; [Column(title:"Текст", gridViewAutoSize:GridViewAutoSize.Fill, isUseAutoSize:true)] public string Body { get; set; } = string.Empty; + + public int Id { get; set; } } } diff --git a/Confectionery/ConfectioneryDataBaseImplement/Migrations/20230515055212_IdForMessageInfo.Designer.cs b/Confectionery/ConfectioneryDataBaseImplement/Migrations/20230515055212_IdForMessageInfo.Designer.cs new file mode 100644 index 0000000..7e6e3b4 --- /dev/null +++ b/Confectionery/ConfectioneryDataBaseImplement/Migrations/20230515055212_IdForMessageInfo.Designer.cs @@ -0,0 +1,281 @@ +// +using System; +using ConfectioneryDataBaseImplement; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace ConfectioneryDataBaseImplement.Migrations +{ + [DbContext(typeof(ConfectioneryDatabase))] + [Migration("20230515055212_IdForMessageInfo")] + partial class IdForMessageInfo + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.3") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("ConfectioneryDataBaseImplement.Models.Client", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClientFIO") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Password") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Clients"); + }); + + modelBuilder.Entity("ConfectioneryDataBaseImplement.Models.Implementer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ImplementerFIO") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Password") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Qualification") + .HasColumnType("int"); + + b.Property("WorkExperience") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Implementers"); + }); + + modelBuilder.Entity("ConfectioneryDataBaseImplement.Models.Ingredient", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Cost") + .HasColumnType("float"); + + b.Property("IngredientName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Ingredients"); + }); + + modelBuilder.Entity("ConfectioneryDataBaseImplement.Models.MessageInfo", b => + { + b.Property("MessageId") + .HasColumnType("nvarchar(450)"); + + b.Property("Body") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ClientId") + .HasColumnType("int"); + + b.Property("DateDelivery") + .HasColumnType("datetime2"); + + b.Property("Id") + .HasColumnType("int"); + + b.Property("SenderName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Subject") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("MessageId"); + + b.ToTable("MessageInfos"); + }); + + modelBuilder.Entity("ConfectioneryDataBaseImplement.Models.Order", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClientId") + .HasColumnType("int"); + + b.Property("Count") + .HasColumnType("int"); + + b.Property("DateCreate") + .HasColumnType("datetime2"); + + b.Property("DateImplement") + .HasColumnType("datetime2"); + + b.Property("ImplementerId") + .HasColumnType("int"); + + b.Property("PastryId") + .HasColumnType("int"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("Sum") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.HasIndex("ClientId"); + + b.HasIndex("ImplementerId"); + + b.HasIndex("PastryId"); + + b.ToTable("Orders"); + }); + + modelBuilder.Entity("ConfectioneryDataBaseImplement.Models.Pastry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("PastryName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Price") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.ToTable("Pastrys"); + }); + + modelBuilder.Entity("ConfectioneryDataBaseImplement.Models.PastryIngredient", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Count") + .HasColumnType("int"); + + b.Property("IngredientId") + .HasColumnType("int"); + + b.Property("PastryId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("IngredientId"); + + b.HasIndex("PastryId"); + + b.ToTable("PastryIngredients"); + }); + + modelBuilder.Entity("ConfectioneryDataBaseImplement.Models.Order", b => + { + b.HasOne("ConfectioneryDataBaseImplement.Models.Client", "Client") + .WithMany() + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("ConfectioneryDataBaseImplement.Models.Implementer", "Implementer") + .WithMany("Orders") + .HasForeignKey("ImplementerId"); + + b.HasOne("ConfectioneryDataBaseImplement.Models.Pastry", null) + .WithMany("Orders") + .HasForeignKey("PastryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Client"); + + b.Navigation("Implementer"); + }); + + modelBuilder.Entity("ConfectioneryDataBaseImplement.Models.PastryIngredient", b => + { + b.HasOne("ConfectioneryDataBaseImplement.Models.Ingredient", "Ingredient") + .WithMany("PastryIgredients") + .HasForeignKey("IngredientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("ConfectioneryDataBaseImplement.Models.Pastry", "Pastry") + .WithMany("Ingredients") + .HasForeignKey("PastryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Ingredient"); + + b.Navigation("Pastry"); + }); + + modelBuilder.Entity("ConfectioneryDataBaseImplement.Models.Implementer", b => + { + b.Navigation("Orders"); + }); + + modelBuilder.Entity("ConfectioneryDataBaseImplement.Models.Ingredient", b => + { + b.Navigation("PastryIgredients"); + }); + + modelBuilder.Entity("ConfectioneryDataBaseImplement.Models.Pastry", b => + { + b.Navigation("Ingredients"); + + b.Navigation("Orders"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Confectionery/ConfectioneryDataBaseImplement/Migrations/20230515055212_IdForMessageInfo.cs b/Confectionery/ConfectioneryDataBaseImplement/Migrations/20230515055212_IdForMessageInfo.cs new file mode 100644 index 0000000..e67fb33 --- /dev/null +++ b/Confectionery/ConfectioneryDataBaseImplement/Migrations/20230515055212_IdForMessageInfo.cs @@ -0,0 +1,29 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace ConfectioneryDataBaseImplement.Migrations +{ + /// + public partial class IdForMessageInfo : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "Id", + table: "MessageInfos", + type: "int", + nullable: false, + defaultValue: 0); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "Id", + table: "MessageInfos"); + } + } +} diff --git a/Confectionery/ConfectioneryDataBaseImplement/Migrations/ConfectioneryDatabaseModelSnapshot.cs b/Confectionery/ConfectioneryDataBaseImplement/Migrations/ConfectioneryDatabaseModelSnapshot.cs index ce1089f..342cf99 100644 --- a/Confectionery/ConfectioneryDataBaseImplement/Migrations/ConfectioneryDatabaseModelSnapshot.cs +++ b/Confectionery/ConfectioneryDataBaseImplement/Migrations/ConfectioneryDatabaseModelSnapshot.cs @@ -109,6 +109,9 @@ namespace ConfectioneryDataBaseImplement.Migrations b.Property("DateDelivery") .HasColumnType("datetime2"); + b.Property("Id") + .HasColumnType("int"); + b.Property("SenderName") .IsRequired() .HasColumnType("nvarchar(max)"); diff --git a/Confectionery/ConfectioneryDataBaseImplement/Models/MessageInfo.cs b/Confectionery/ConfectioneryDataBaseImplement/Models/MessageInfo.cs index 0d2eaf3..1e1a106 100644 --- a/Confectionery/ConfectioneryDataBaseImplement/Models/MessageInfo.cs +++ b/Confectionery/ConfectioneryDataBaseImplement/Models/MessageInfo.cs @@ -60,5 +60,6 @@ namespace ConfectioneryDataBaseImplement.Models Subject = Subject, DateDelivery = DateDelivery }; + public int Id { get; set; } } } diff --git a/Confectionery/ConfectioneryDataModels/Models/IMessageInfoModel.cs b/Confectionery/ConfectioneryDataModels/Models/IMessageInfoModel.cs index b9ef9d2..e005065 100644 --- a/Confectionery/ConfectioneryDataModels/Models/IMessageInfoModel.cs +++ b/Confectionery/ConfectioneryDataModels/Models/IMessageInfoModel.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; namespace ConfectioneryDataModels.Models { - public interface IMessageInfoModel + public interface IMessageInfoModel : IId { string MessageId { get; } int? ClientId { get; } diff --git a/Confectionery/ConfectioneryFileImplements/Models/MessageInfo.cs b/Confectionery/ConfectioneryFileImplements/Models/MessageInfo.cs index 5afc9cc..68c45a9 100644 --- a/Confectionery/ConfectioneryFileImplements/Models/MessageInfo.cs +++ b/Confectionery/ConfectioneryFileImplements/Models/MessageInfo.cs @@ -78,5 +78,7 @@ namespace ConfectioneryFileImplement.Models new XElement("Subject", Subject), new XElement("Body", Body), new XElement("DateDelivery", DateDelivery.ToString())); + + public int Id { get; set; } } } diff --git a/Confectionery/ConfectioneryListImplement/Models/MessageInfo.cs b/Confectionery/ConfectioneryListImplement/Models/MessageInfo.cs index 18b93e9..42c29a8 100644 --- a/Confectionery/ConfectioneryListImplement/Models/MessageInfo.cs +++ b/Confectionery/ConfectioneryListImplement/Models/MessageInfo.cs @@ -44,5 +44,7 @@ namespace ConfectioneryListImplement.Models Subject = Subject, DateDelivery = DateDelivery }; + + public int Id { get; set; } } }