Guarantor: Report logic was changed + might be needed to create property TotalAmount for PCs.
This commit is contained in:
parent
9347ef10b4
commit
c2baea1737
@ -5,6 +5,7 @@ using ComputerStoreContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@ -12,7 +13,6 @@ namespace ComputerStoreBusinessLogic.BusinessLogic
|
||||
{
|
||||
public class EmployeeReportLogic : IEmployeeReportLogic
|
||||
{
|
||||
//asd
|
||||
private readonly IPCStorage _pcStorage;
|
||||
private readonly IProductStorage _productStorage;
|
||||
private readonly IConsignmentStorage _consignmentStorage;
|
||||
@ -37,20 +37,14 @@ namespace ComputerStoreBusinessLogic.BusinessLogic
|
||||
{
|
||||
PCName = pc.Name,
|
||||
Components = new List<(string Component, int count)>(),
|
||||
Requests = new List<int>(),
|
||||
TotalAmount = 0
|
||||
Request = requests.Where(x => x.RequestProduct.First(y => y.ID == pc.ID)).Select(x => x.ID)
|
||||
};
|
||||
|
||||
foreach (var request in requests)
|
||||
{
|
||||
record.Requests.Add(request.RequestProducts.FirstOrDefault(x => x.ID == pc.ID).Select(x => x.ID));
|
||||
}
|
||||
|
||||
foreach (var component in pc.PCComponents)
|
||||
{
|
||||
record.Components.Add(new(component.Value.Item1.Name, component.Value.Item2));
|
||||
}
|
||||
record.TotalAmount = record.Requests.Count;
|
||||
list.Add(record);
|
||||
}
|
||||
return list;
|
||||
|
@ -11,6 +11,6 @@ namespace ComputerStoreContracts.ViewModels
|
||||
public string PCName { get; set; } = string.Empty;
|
||||
public int TotalAmount { get; set; }
|
||||
public List<(string Component, int count)> Components { get; set; } = new List<(string Component, int count)> ();
|
||||
public List<int> Requests { get; set; } = new List<int> ();
|
||||
public int Request { get; set; }
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user