diff --git a/SushiBar/SushiBar/FormMain.cs b/SushiBar/SushiBar/FormMain.cs index 9841dc6..01cf497 100644 --- a/SushiBar/SushiBar/FormMain.cs +++ b/SushiBar/SushiBar/FormMain.cs @@ -31,6 +31,7 @@ namespace SushiBarView { dataGridView.DataSource = list; dataGridView.Columns["SushiId"].Visible = false; + } _logger.LogInformation("Загрузка заказов"); } diff --git a/SushiBar/SushiBar/Program.cs b/SushiBar/SushiBar/Program.cs index b1eb43d..51e109b 100644 --- a/SushiBar/SushiBar/Program.cs +++ b/SushiBar/SushiBar/Program.cs @@ -7,6 +7,7 @@ using SushiBarBusinessLogic.OfficePackage; using SushiBarContracts.BusinessLogicsContracts; using SushiBarContracts.StoragesContracts; using SushiBarDatabaseImplement.Implements; +using SushiBarBusinessLogic; namespace SushiBarView { @@ -41,11 +42,15 @@ namespace SushiBarView services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient(); @@ -53,6 +58,7 @@ namespace SushiBarView services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient(); diff --git a/SushiBar/SushiBar/SushiBarView.csproj b/SushiBar/SushiBar/SushiBarView.csproj index f5411e8..8cfbc34 100644 --- a/SushiBar/SushiBar/SushiBarView.csproj +++ b/SushiBar/SushiBar/SushiBarView.csproj @@ -11,8 +11,8 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/SushiBar/SushiBarClientApp/Controllers/HomeController.cs b/SushiBar/SushiBarClientApp/Controllers/HomeController.cs index 07ba9b2..4bace62 100644 --- a/SushiBar/SushiBarClientApp/Controllers/HomeController.cs +++ b/SushiBar/SushiBarClientApp/Controllers/HomeController.cs @@ -1,6 +1,7 @@ using Microsoft.AspNetCore.Mvc; using SushiBarClientApp.Models; using SushiBarContracts.BindingModel; +using SushiBarContracts.BindingModels; using SushiBarContracts.ViewModels; using System.Diagnostics; diff --git a/SushiBar/SushiBarClientApp/SushiBarClientApp.csproj b/SushiBar/SushiBarClientApp/SushiBarClientApp.csproj index b6bd040..a38181b 100644 --- a/SushiBar/SushiBarClientApp/SushiBarClientApp.csproj +++ b/SushiBar/SushiBarClientApp/SushiBarClientApp.csproj @@ -9,7 +9,7 @@ - + diff --git a/SushiBar/SushiBarContracts/BindingModels/OrderBindingModel.cs b/SushiBar/SushiBarContracts/BindingModels/OrderBindingModel.cs index 9f761e8..bb952f8 100644 --- a/SushiBar/SushiBarContracts/BindingModels/OrderBindingModel.cs +++ b/SushiBar/SushiBarContracts/BindingModels/OrderBindingModel.cs @@ -12,5 +12,8 @@ namespace SushiBarContracts.BindingModels public DateTime DateCreate { get; set; } = DateTime.Now; public DateTime? DateImplement { get; set; } public int Id { get; set; } + + public int ClientId { get; set; } + public string ClientFIO { get; set; } = string.Empty; } } diff --git a/SushiBar/SushiBarContracts/SearchModels/OrderSearchModel.cs b/SushiBar/SushiBarContracts/SearchModels/OrderSearchModel.cs index 83bad5f..d8640c1 100644 --- a/SushiBar/SushiBarContracts/SearchModels/OrderSearchModel.cs +++ b/SushiBar/SushiBarContracts/SearchModels/OrderSearchModel.cs @@ -6,6 +6,7 @@ namespace SushiBarContracts.SearchModels public int? Id { get; set; } public DateTime? DateTo { get; set; } public DateTime? DateFrom { get; set; } + public int ClientId { get; set; } } } diff --git a/SushiBar/SushiBarContracts/ViewModels/OrderViewModel.cs b/SushiBar/SushiBarContracts/ViewModels/OrderViewModel.cs index 172322a..127d2aa 100644 --- a/SushiBar/SushiBarContracts/ViewModels/OrderViewModel.cs +++ b/SushiBar/SushiBarContracts/ViewModels/OrderViewModel.cs @@ -8,9 +8,13 @@ namespace SushiBarContracts.ViewModels { [DisplayName("Номер")] public int Id { get; set; } + public int ClientId { get; set; } + [DisplayName("Имя клиента")] + public string ClientFIO { get; set; } = string.Empty; public int SushiId { get; set; } [DisplayName("Суши")] public string SushiName { get; set; } = string.Empty; + [DisplayName("Количество")] public int Count { get; set; } [DisplayName("Сумма")] diff --git a/SushiBar/SushiBarDataModels/Models/IOrderModel.cs b/SushiBar/SushiBarDataModels/Models/IOrderModel.cs index 3770e12..7330013 100644 --- a/SushiBar/SushiBarDataModels/Models/IOrderModel.cs +++ b/SushiBar/SushiBarDataModels/Models/IOrderModel.cs @@ -5,6 +5,7 @@ namespace SushiBarDataModels.Models public interface IOrderModel : IId { int SushiId { get; } + int ClientId { get; } int Count { get; } double Sum { get; } OrderStatus Status { get; } diff --git a/SushiBar/SushiBarDatabaseImplement/Implements/OrderStorage.cs b/SushiBar/SushiBarDatabaseImplement/Implements/OrderStorage.cs index a288b77..be05502 100644 --- a/SushiBar/SushiBarDatabaseImplement/Implements/OrderStorage.cs +++ b/SushiBar/SushiBarDatabaseImplement/Implements/OrderStorage.cs @@ -32,7 +32,7 @@ namespace SushiBarDatabaseImplement.Implements } using var context = new SushiBarDatabase(); return context.Orders - .Include(x => x.Sushi) + .Include(x => x.Sushi).Include(x => x.Client) .FirstOrDefault(x => model.Id.HasValue && x.Id == model.Id) ?.GetViewModel; } @@ -48,6 +48,7 @@ namespace SushiBarDatabaseImplement.Implements { return context.Orders .Include(x => x.Sushi) + .Include(x => x.Client) .Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo) .Select(x => x.GetViewModel) .ToList(); @@ -74,6 +75,7 @@ namespace SushiBarDatabaseImplement.Implements context.SaveChanges(); return context.Orders .Include(x => x.Sushi) + .Include(x => x.Client) .FirstOrDefault(x => x.Id == newOrder.Id) ?.GetViewModel; } @@ -83,6 +85,7 @@ namespace SushiBarDatabaseImplement.Implements using var context = new SushiBarDatabase(); var order = context.Orders .Include(x => x.Sushi) + .Include(x => x.Client) .FirstOrDefault(x => x.Id == model.Id); if (order == null) { diff --git a/SushiBar/SushiBarDatabaseImplement/Migrations/20240501085423_Add_client.Designer.cs b/SushiBar/SushiBarDatabaseImplement/Migrations/20240501085423_Add_client.Designer.cs new file mode 100644 index 0000000..cc385ab --- /dev/null +++ b/SushiBar/SushiBarDatabaseImplement/Migrations/20240501085423_Add_client.Designer.cs @@ -0,0 +1,214 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using SushiBarDatabaseImplement; + +#nullable disable + +namespace SushiBarDatabaseImplement.Migrations +{ + [DbContext(typeof(SushiBarDatabase))] + [Migration("20240501085423_Add_client")] + partial class Add_client + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.4") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("SushiBarDatabaseImplement.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("SushiBarDatabaseImplement.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("SushiBarDatabaseImplement.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("Status") + .HasColumnType("int"); + + b.Property("Sum") + .HasColumnType("float"); + + b.Property("SushiId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ClientId"); + + b.HasIndex("SushiId"); + + b.ToTable("Orders"); + }); + + modelBuilder.Entity("SushiBarDatabaseImplement.Models.Sushi", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Price") + .HasColumnType("float"); + + b.Property("SushiName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("ListSushi"); + }); + + modelBuilder.Entity("SushiBarDatabaseImplement.Models.SushiIngredient", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Count") + .HasColumnType("int"); + + b.Property("IngredientId") + .HasColumnType("int"); + + b.Property("SushiId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("IngredientId"); + + b.HasIndex("SushiId"); + + b.ToTable("SushiIngredients"); + }); + + modelBuilder.Entity("SushiBarDatabaseImplement.Models.Order", b => + { + b.HasOne("SushiBarDatabaseImplement.Models.Client", "Client") + .WithMany("Orders") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SushiBarDatabaseImplement.Models.Sushi", "Sushi") + .WithMany("Orders") + .HasForeignKey("SushiId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Client"); + + b.Navigation("Sushi"); + }); + + modelBuilder.Entity("SushiBarDatabaseImplement.Models.SushiIngredient", b => + { + b.HasOne("SushiBarDatabaseImplement.Models.Ingredient", "Ingredient") + .WithMany("SushiIngredients") + .HasForeignKey("IngredientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SushiBarDatabaseImplement.Models.Sushi", "Sushi") + .WithMany("Ingredients") + .HasForeignKey("SushiId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Ingredient"); + + b.Navigation("Sushi"); + }); + + modelBuilder.Entity("SushiBarDatabaseImplement.Models.Client", b => + { + b.Navigation("Orders"); + }); + + modelBuilder.Entity("SushiBarDatabaseImplement.Models.Ingredient", b => + { + b.Navigation("SushiIngredients"); + }); + + modelBuilder.Entity("SushiBarDatabaseImplement.Models.Sushi", b => + { + b.Navigation("Ingredients"); + + b.Navigation("Orders"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/SushiBar/SushiBarDatabaseImplement/Migrations/20240501085423_Add_client.cs b/SushiBar/SushiBarDatabaseImplement/Migrations/20240501085423_Add_client.cs new file mode 100644 index 0000000..8b62586 --- /dev/null +++ b/SushiBar/SushiBarDatabaseImplement/Migrations/20240501085423_Add_client.cs @@ -0,0 +1,68 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace SushiBarDatabaseImplement.Migrations +{ + /// + public partial class Add_client : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "ClientId", + table: "Orders", + type: "int", + nullable: false, + defaultValue: 0); + + migrationBuilder.CreateTable( + name: "Clients", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + ClientFIO = table.Column(type: "nvarchar(max)", nullable: false), + Email = table.Column(type: "nvarchar(max)", nullable: false), + Password = table.Column(type: "nvarchar(max)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Clients", x => x.Id); + }); + + migrationBuilder.CreateIndex( + name: "IX_Orders_ClientId", + table: "Orders", + column: "ClientId"); + + migrationBuilder.AddForeignKey( + name: "FK_Orders_Clients_ClientId", + table: "Orders", + column: "ClientId", + principalTable: "Clients", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Orders_Clients_ClientId", + table: "Orders"); + + migrationBuilder.DropTable( + name: "Clients"); + + migrationBuilder.DropIndex( + name: "IX_Orders_ClientId", + table: "Orders"); + + migrationBuilder.DropColumn( + name: "ClientId", + table: "Orders"); + } + } +} diff --git a/SushiBar/SushiBarDatabaseImplement/Migrations/SushiBarDatabaseModelSnapshot.cs b/SushiBar/SushiBarDatabaseImplement/Migrations/SushiBarDatabaseModelSnapshot.cs index 2644977..1bcf53a 100644 --- a/SushiBar/SushiBarDatabaseImplement/Migrations/SushiBarDatabaseModelSnapshot.cs +++ b/SushiBar/SushiBarDatabaseImplement/Migrations/SushiBarDatabaseModelSnapshot.cs @@ -17,11 +17,36 @@ namespace SushiBarDatabaseImplement.Migrations { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "8.0.3") + .HasAnnotation("ProductVersion", "8.0.4") .HasAnnotation("Relational:MaxIdentifierLength", 128); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + modelBuilder.Entity("SushiBarDatabaseImplement.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("SushiBarDatabaseImplement.Models.Ingredient", b => { b.Property("Id") @@ -50,6 +75,9 @@ namespace SushiBarDatabaseImplement.Migrations SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + b.Property("ClientId") + .HasColumnType("int"); + b.Property("Count") .HasColumnType("int"); @@ -70,6 +98,8 @@ namespace SushiBarDatabaseImplement.Migrations b.HasKey("Id"); + b.HasIndex("ClientId"); + b.HasIndex("SushiId"); b.ToTable("Orders"); @@ -123,12 +153,20 @@ namespace SushiBarDatabaseImplement.Migrations modelBuilder.Entity("SushiBarDatabaseImplement.Models.Order", b => { + b.HasOne("SushiBarDatabaseImplement.Models.Client", "Client") + .WithMany("Orders") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + b.HasOne("SushiBarDatabaseImplement.Models.Sushi", "Sushi") .WithMany("Orders") .HasForeignKey("SushiId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + b.Navigation("Client"); + b.Navigation("Sushi"); }); @@ -151,6 +189,11 @@ namespace SushiBarDatabaseImplement.Migrations b.Navigation("Sushi"); }); + modelBuilder.Entity("SushiBarDatabaseImplement.Models.Client", b => + { + b.Navigation("Orders"); + }); + modelBuilder.Entity("SushiBarDatabaseImplement.Models.Ingredient", b => { b.Navigation("SushiIngredients"); diff --git a/SushiBar/SushiBarDatabaseImplement/Models/Client.cs b/SushiBar/SushiBarDatabaseImplement/Models/Client.cs index 5260d67..fde667a 100644 --- a/SushiBar/SushiBarDatabaseImplement/Models/Client.cs +++ b/SushiBar/SushiBarDatabaseImplement/Models/Client.cs @@ -19,7 +19,7 @@ namespace SushiBarDatabaseImplement.Models [Required] public string Password { get; private set; } = string.Empty; - [ForeignKey("ID")] + [ForeignKey("ClientId")] public virtual List Orders { get; set; } = new(); public static Client? Create(ClientBindingModel? model) diff --git a/SushiBar/SushiBarDatabaseImplement/Models/Order.cs b/SushiBar/SushiBarDatabaseImplement/Models/Order.cs index 9fc4709..6326d41 100644 --- a/SushiBar/SushiBarDatabaseImplement/Models/Order.cs +++ b/SushiBar/SushiBarDatabaseImplement/Models/Order.cs @@ -3,6 +3,7 @@ using SushiBarContracts.ViewModels; using SushiBarDataModels.Enums; using SushiBarDataModels.Models; using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; namespace SushiBarDatabaseImplement.Models { @@ -13,6 +14,8 @@ namespace SushiBarDatabaseImplement.Models [Required] public int Count { get; set; } [Required] + public int ClientId { get; set; } + [Required] public double Sum { get; set; } [Required] public OrderStatus Status { get; set; } @@ -20,7 +23,8 @@ namespace SushiBarDatabaseImplement.Models public DateTime DateCreate { get; set; } public DateTime? DateImplement { get; set; } public int Id { get; set; } - public Sushi Sushi { get; set; } + public virtual Client? Client { get; set; } + public Sushi? Sushi { get; set; } public static Order? Create(OrderBindingModel? model) { if (model == null) @@ -36,6 +40,7 @@ namespace SushiBarDatabaseImplement.Models Status = model.Status, DateCreate = model.DateCreate, DateImplement = model.DateImplement, + ClientId = model.ClientId }; } @@ -59,6 +64,8 @@ namespace SushiBarDatabaseImplement.Models Id = Id, Status = Status, SushiName = Sushi.SushiName, + ClientId = ClientId, + ClientFIO = Client.ClientFIO }; } } diff --git a/SushiBar/SushiBarDatabaseImplement/SushiBarDatabase.cs b/SushiBar/SushiBarDatabaseImplement/SushiBarDatabase.cs index 24dad36..ce46b83 100644 --- a/SushiBar/SushiBarDatabaseImplement/SushiBarDatabase.cs +++ b/SushiBar/SushiBarDatabaseImplement/SushiBarDatabase.cs @@ -19,7 +19,6 @@ namespace SushiBarDatabaseImplement public virtual DbSet ListSushi { set; get; } public virtual DbSet SushiIngredients { set; get; } - public virtual DbSet Orders { set; get; } public virtual DbSet Clients { set; get; } } diff --git a/SushiBar/SushiBarDatabaseImplement/SushiBarDatabaseImplement.csproj b/SushiBar/SushiBarDatabaseImplement/SushiBarDatabaseImplement.csproj index 4528a34..ec6a8f0 100644 --- a/SushiBar/SushiBarDatabaseImplement/SushiBarDatabaseImplement.csproj +++ b/SushiBar/SushiBarDatabaseImplement/SushiBarDatabaseImplement.csproj @@ -7,9 +7,9 @@ - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/SushiBar/SushiBarFileImplement/Models/Order.cs b/SushiBar/SushiBarFileImplement/Models/Order.cs index 3f8160b..2b82902 100644 --- a/SushiBar/SushiBarFileImplement/Models/Order.cs +++ b/SushiBar/SushiBarFileImplement/Models/Order.cs @@ -10,6 +10,7 @@ namespace SushiBarFileImplement.Models { public int Id { get; private set; } public int SushiId { get; private set; } + public int ClientId { get; private set; } public int Count { get; private set; } public double Sum { get; private set; } public OrderStatus Status { get; private set; } = OrderStatus.Неизвестен; @@ -25,6 +26,7 @@ namespace SushiBarFileImplement.Models { Id = model.Id, SushiId = model.SushiId, + ClientId = model.ClientId, Count = model.Count, Sum = model.Sum, Status = model.Status, @@ -43,6 +45,7 @@ namespace SushiBarFileImplement.Models { Id = Convert.ToInt32(element.Attribute("Id")!.Value), SushiId = Convert.ToInt32(element.Element("SushiId")!.Value), + ClientId = Convert.ToInt32(element.Element("ClientId")!.Value), Sum = Convert.ToDouble(element.Element("Sum")!.Value), Count = Convert.ToInt32(element.Element("Count")!.Value), Status = (OrderStatus)Enum.Parse(typeof(OrderStatus), element.Element("Status")!.Value), @@ -70,11 +73,13 @@ namespace SushiBarFileImplement.Models DateImplement = DateImplement, Id = Id, Status = Status, + ClientId = ClientId, }; public XElement GetXElement => new("Order", new XAttribute("Id", Id), new XElement("SushiId", SushiId), + new XElement("ClientId", ClientId.ToString()), new XElement("Count", Count.ToString()), new XElement("Sum", Sum.ToString()), new XElement("Status", Status.ToString()), diff --git a/SushiBar/SushiBarListImplement/Models/Order.cs b/SushiBar/SushiBarListImplement/Models/Order.cs index 445b162..5352341 100644 --- a/SushiBar/SushiBarListImplement/Models/Order.cs +++ b/SushiBar/SushiBarListImplement/Models/Order.cs @@ -9,6 +9,7 @@ namespace SushiBarListImplement.Models { public int Id { get; private set; } public int SushiId { get; private set; } + public int ClientId { get; private set; } public int Count { get; private set; } public double Sum { get; private set; } public OrderStatus Status { get; private set; } = OrderStatus.Неизвестен; @@ -29,6 +30,7 @@ namespace SushiBarListImplement.Models DateCreate = model.DateCreate, DateImplement = model.DateImplement, Id = model.Id, + ClientId = model.ClientId, }; } public void Update(OrderBindingModel? model) @@ -37,18 +39,24 @@ namespace SushiBarListImplement.Models { return; } + SushiId = model.SushiId; + Count = model.Count; + Sum = model.Sum; Status = model.Status; + DateCreate = model.DateCreate; DateImplement = model.DateImplement; + ClientId = model.ClientId; } public OrderViewModel GetViewModel => new() { + Id = Id, SushiId = SushiId, Count = Count, Sum = Sum, + Status = Status, DateCreate = DateCreate, DateImplement = DateImplement, - Id = Id, - Status = Status, + ClientId = ClientId, }; } } diff --git a/SushiBar/SushiBarRestApi/Controllers/MainController.cs b/SushiBar/SushiBarRestApi/Controllers/MainController.cs index 87bbc20..a15b13b 100644 --- a/SushiBar/SushiBarRestApi/Controllers/MainController.cs +++ b/SushiBar/SushiBarRestApi/Controllers/MainController.cs @@ -1,8 +1,10 @@ using DocumentFormat.OpenXml.Office2010.Excel; using Microsoft.AspNetCore.Mvc; using SushiBarContracts.BindingModel; +using SushiBarContracts.BindingModels; using SushiBarContracts.BusinessLogicsContracts; using SushiBarContracts.SearchModel; +using SushiBarContracts.SearchModels; using SushiBarContracts.ViewModels; namespace SushiBarRestApi.Controllers diff --git a/SushiBar/SushiBarRestApi/Program.cs b/SushiBar/SushiBarRestApi/Program.cs index b7ad3c9..293a60c 100644 --- a/SushiBar/SushiBarRestApi/Program.cs +++ b/SushiBar/SushiBarRestApi/Program.cs @@ -2,8 +2,8 @@ using SushiBarContracts.BusinessLogicsContracts; using SushiBarContracts.StoragesContracts; using SushiBarDatabaseImplement.Implements; using Microsoft.OpenApi.Models; -using SushiBarBusinessLogic.BusinessLogic; using SushiBarBusinessLogic; +using SushiBarBusinessLogic.BusinessLogics; var builder = WebApplication.CreateBuilder(args); builder.Logging.SetMinimumLevel(LogLevel.Trace);