LabWork03_Hard: Фиксы
This commit is contained in:
@@ -100,6 +100,7 @@ namespace AutomobilePlantDatabaseImplement.Implements
|
||||
}
|
||||
|
||||
car.Update(model);
|
||||
car.UpdateComponents(context, model);
|
||||
|
||||
context.SaveChanges();
|
||||
context.Database.CommitTransaction();
|
||||
|
||||
@@ -77,14 +77,17 @@ namespace AutomobilePlantDatabaseImplement.Implements
|
||||
using var transaction = context.Database.BeginTransaction();
|
||||
try
|
||||
{
|
||||
var shop = context.Shops.FirstOrDefault(x => x.Id == model.Id);
|
||||
var shop = context.Shops.Include(x => x.Cars).FirstOrDefault(x => x.Id == model.Id);
|
||||
if (shop == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
shop.Update(model);
|
||||
context.SaveChanges();
|
||||
shop.UpdateCars(context, model);
|
||||
if (model.ShopCars.Count > 0)
|
||||
{
|
||||
shop.UpdateCars(context, model);
|
||||
}
|
||||
transaction.Commit();
|
||||
return shop.GetViewModel;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user