Compare commits
No commits in common. "fc5a9b69c52017ac77a9377e048e94d4123f32f7" and "928cc253dd53a242d5895548001f4fef89181364" have entirely different histories.
fc5a9b69c5
...
928cc253dd
@ -33,6 +33,7 @@ namespace AutomobilePlantBusinessLogic.BusinessLogics
|
|||||||
/// Получение списка компонент с указанием, в каких изделиях используются
|
/// Получение списка компонент с указанием, в каких изделиях используются
|
||||||
public List<ReportCarComponentViewModel> GetCarComponents()
|
public List<ReportCarComponentViewModel> GetCarComponents()
|
||||||
{
|
{
|
||||||
|
var components = _componentStorage.GetFullList();
|
||||||
var cars = _carStorage.GetFullList();
|
var cars = _carStorage.GetFullList();
|
||||||
var list = new List<ReportCarComponentViewModel>();
|
var list = new List<ReportCarComponentViewModel>();
|
||||||
foreach (var car in cars)
|
foreach (var car in cars)
|
||||||
@ -43,10 +44,13 @@ namespace AutomobilePlantBusinessLogic.BusinessLogics
|
|||||||
Components = new List<(string Component, int Count)>(),
|
Components = new List<(string Component, int Count)>(),
|
||||||
TotalCount = 0
|
TotalCount = 0
|
||||||
};
|
};
|
||||||
foreach (var component in car.CarComponents.Values)
|
foreach (var component in components)
|
||||||
{
|
{
|
||||||
record.Components.Add((component.Item1.ComponentName, component.Item2));
|
if (car.CarComponents.ContainsKey(component.Id))
|
||||||
record.TotalCount += component.Item2;
|
{
|
||||||
|
record.Components.Add(new(component.ComponentName, car.CarComponents[component.Id].Item2));
|
||||||
|
record.TotalCount += car.CarComponents[component.Id].Item2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
list.Add(record);
|
list.Add(record);
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,6 @@ using System.Reflection.Metadata;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using System.Xml.Linq;
|
|
||||||
|
|
||||||
namespace AutomobilePlantDatabaseImplement.Implements
|
namespace AutomobilePlantDatabaseImplement.Implements
|
||||||
{
|
{
|
||||||
@ -101,7 +100,6 @@ namespace AutomobilePlantDatabaseImplement.Implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
car.Update(model);
|
car.Update(model);
|
||||||
car.UpdateComponents(context, model);
|
|
||||||
|
|
||||||
context.SaveChanges();
|
context.SaveChanges();
|
||||||
context.Database.CommitTransaction();
|
context.Database.CommitTransaction();
|
||||||
|
Loading…
Reference in New Issue
Block a user