Исправление ошибки
This commit is contained in:
parent
2e0bf741a9
commit
88df8068a5
@ -90,6 +90,7 @@ namespace AutomobilePlantDataBaseImplements.Implements
|
||||
using var context = new AutoPlantDataBase();
|
||||
using var transaction = context.Database.BeginTransaction();
|
||||
var shops = GetFullList();
|
||||
bool check = false;
|
||||
try
|
||||
{
|
||||
foreach (var shop in shops)
|
||||
@ -100,7 +101,8 @@ namespace AutomobilePlantDataBaseImplements.Implements
|
||||
{
|
||||
shop.Cars[car.Id] = (shop.Cars[car.Id].Item1, shop.Cars[car.Id].Item2 - quantity);
|
||||
quantity = 0;
|
||||
break;
|
||||
check = true;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -118,6 +120,8 @@ namespace AutomobilePlantDataBaseImplements.Implements
|
||||
Id = shop.Id,
|
||||
Cars = shop.Cars,
|
||||
});
|
||||
if (check)
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
@ -125,7 +129,12 @@ namespace AutomobilePlantDataBaseImplements.Implements
|
||||
{
|
||||
context.SaveChanges();
|
||||
transaction.Commit();
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
transaction.Rollback();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch
|
||||
|
Loading…
x
Reference in New Issue
Block a user