Compare commits

...

3 Commits

Author SHA1 Message Date
fc5a9b69c5 LabWork04_Base: Фиксы 2023-04-09 21:34:28 +04:00
f77d3f66cc Merge branch 'LabWork03_Base' into LabWork04_Base 2023-04-09 21:29:51 +04:00
3a965ffbe3 LabWork03_Base: Фиксы 2023-04-09 21:27:20 +04:00
2 changed files with 5 additions and 7 deletions

View File

@ -33,7 +33,6 @@ namespace AutomobilePlantBusinessLogic.BusinessLogics
/// Получение списка компонент с указанием, в каких изделиях используются
public List<ReportCarComponentViewModel> GetCarComponents()
{
var components = _componentStorage.GetFullList();
var cars = _carStorage.GetFullList();
var list = new List<ReportCarComponentViewModel>();
foreach (var car in cars)
@ -44,13 +43,10 @@ namespace AutomobilePlantBusinessLogic.BusinessLogics
Components = new List<(string Component, int Count)>(),
TotalCount = 0
};
foreach (var component in components)
foreach (var component in car.CarComponents.Values)
{
if (car.CarComponents.ContainsKey(component.Id))
{
record.Components.Add(new(component.ComponentName, car.CarComponents[component.Id].Item2));
record.TotalCount += car.CarComponents[component.Id].Item2;
}
record.Components.Add((component.Item1.ComponentName, component.Item2));
record.TotalCount += component.Item2;
}
list.Add(record);
}

View File

@ -10,6 +10,7 @@ using System.Reflection.Metadata;
using System.Text;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using System.Xml.Linq;
namespace AutomobilePlantDatabaseImplement.Implements
{
@ -100,6 +101,7 @@ namespace AutomobilePlantDatabaseImplement.Implements
}
car.Update(model);
car.UpdateComponents(context, model);
context.SaveChanges();
context.Database.CommitTransaction();