diff --git a/ComputerStoreBusinessLogic/OfficePackage/AbstractSaveToWord.cs b/ComputerStoreBusinessLogic/OfficePackage/AbstractSaveToWord.cs index af0b886..2d7aef7 100644 --- a/ComputerStoreBusinessLogic/OfficePackage/AbstractSaveToWord.cs +++ b/ComputerStoreBusinessLogic/OfficePackage/AbstractSaveToWord.cs @@ -34,11 +34,11 @@ namespace ComputerStoreBusinessLogic.OfficePackage } }); - foreach(var products in consigment.ConsignmentProducts) + foreach(var products in consigment.Products) { CreateParagraph(new WordParagraph { - Texts = new List<(string, WordTextProperties)> { (products.Value.Item1.Name, new WordTextProperties { Bold = true, Size = "24", }), ($" {products.Value.Item1.Price}", new WordTextProperties { Bold = true, Size = "24", }) }, + Texts = new List<(string, WordTextProperties)> { (products.product, new WordTextProperties { Bold = true, Size = "24", }), ($" {products.count}", new WordTextProperties { Bold = true, Size = "24", }) }, TextProperties = new WordTextProperties { Size = "24", diff --git a/ComputerStoreDatabaseImplement/Models/PC.cs b/ComputerStoreDatabaseImplement/Models/PC.cs index 6495324..914d5ed 100644 --- a/ComputerStoreDatabaseImplement/Models/PC.cs +++ b/ComputerStoreDatabaseImplement/Models/PC.cs @@ -45,6 +45,8 @@ namespace ComputerStoreDatabaseImplement.Models Name = model.Name, Price = model.Price, EmployeeID = model.EmployeeID, + Employee = context.Employees.First(x => x.ID == model.EmployeeID), + Request = context.Requests.First(x => x.ID == model.RequestID), RequestID = model.RequestID, PCComponents = model.PCComponents }; @@ -56,7 +58,7 @@ namespace ComputerStoreDatabaseImplement.Models { rc.PCID = model.ID; } - + context.SaveChanges(); } diff --git a/ComputerStoreRestAPI/Program.cs b/ComputerStoreRestAPI/Program.cs index 0021f51..7c6125a 100644 --- a/ComputerStoreRestAPI/Program.cs +++ b/ComputerStoreRestAPI/Program.cs @@ -1,5 +1,7 @@ using ComputerStoreBusinessLogic.BusinessLogic; using ComputerStoreBusinessLogic.MailStuff; +using ComputerStoreBusinessLogic.OfficePackage; +using ComputerStoreBusinessLogic.OfficePackage.Implements; using ComputerStoreContracts.BindingModels; using ComputerStoreContracts.BusinessLogicContracts; using ComputerStoreContracts.StorageContracts; @@ -36,6 +38,9 @@ builder.Services.AddTransient(); builder.Services.AddTransient(); builder.Services.AddTransient(); +builder.Services.AddTransient(); +builder.Services.AddTransient(); +builder.Services.AddTransient(); builder.Services.AddSingleton(); builder.Services.AddControllers().AddNewtonsoftJson(x => x.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore); @@ -44,6 +49,9 @@ builder.Services.AddControllers().AddNewtonsoftJson(x => x.SerializerSettings.Re builder.Services.AddEndpointsApiExplorer(); builder.Services.AddSwaggerGen(); + + + var app = builder.Build(); var mailSender = app.Services.GetService();