Merge pull request 'fix' (#4) from lab_3 into Lab_4
Reviewed-on: http://student.git.athene.tech/Kate/ISEbd-21_Vasina_E.S._ComputersShop/pulls/4
This commit is contained in:
commit
48cb1ded9c
@ -44,9 +44,9 @@ namespace ComputersShopDatabaseImplement.Implements
|
|||||||
.ToList();
|
.ToList();
|
||||||
foreach (var order in orderList)
|
foreach (var order in orderList)
|
||||||
{
|
{
|
||||||
string manufactureName = context.Computers
|
string computerName = context.Computers
|
||||||
.SingleOrDefault(x => x.Id == order.ComputerId)?.ComputerName ?? string.Empty;
|
.SingleOrDefault(x => x.Id == order.ComputerId)?.ComputerName ?? string.Empty;
|
||||||
order.ComputerName = manufactureName;
|
order.ComputerName = computerName;
|
||||||
}
|
}
|
||||||
return orderList;
|
return orderList;
|
||||||
}
|
}
|
||||||
|
@ -51,14 +51,14 @@ namespace ComputersShopFileImplement.Implements
|
|||||||
}
|
}
|
||||||
public ComputerViewModel? Update(ComputerBindingModel model)
|
public ComputerViewModel? Update(ComputerBindingModel model)
|
||||||
{
|
{
|
||||||
var manufacture = source.Computers.FirstOrDefault(x => x.Id == model.Id);
|
var computer = source.Computers.FirstOrDefault(x => x.Id == model.Id);
|
||||||
if (manufacture == null)
|
if (computer == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
manufacture.Update(model);
|
computer.Update(model);
|
||||||
source.SaveComputers();
|
source.SaveComputers();
|
||||||
return manufacture.GetViewModel;
|
return computer.GetViewModel;
|
||||||
}
|
}
|
||||||
public ComputerViewModel? Delete(ComputerBindingModel model)
|
public ComputerViewModel? Delete(ComputerBindingModel model)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user