RestAPI/logic fixes.

This commit is contained in:
Yuee Shiness 2023-05-19 16:02:23 +04:00
parent 6e2912f1c4
commit ab9da1c1de
3 changed files with 13 additions and 3 deletions

View File

@ -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",

View File

@ -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();
}

View File

@ -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;
@ -29,6 +31,9 @@ builder.Services.AddTransient<IConsignmentLogic,ConsignmentLogic>();
builder.Services.AddTransient<IRequestComponentLogic, RequestComponentLogic>();
builder.Services.AddTransient<IRequestLogic, RequestLogic>();
builder.Services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
builder.Services.AddTransient<AbstractSaveToWord, SaveToWord>();
builder.Services.AddTransient<AbstractSaveToPDF, SaveToPDF>();
builder.Services.AddSingleton<AbstractMail, MailKit>();
builder.Services.AddControllers().AddNewtonsoftJson(x => x.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore);
@ -37,6 +42,9 @@ builder.Services.AddControllers().AddNewtonsoftJson(x => x.SerializerSettings.Re
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
var app = builder.Build();
var mailSender = app.Services.GetService<AbstractMail>();