Eliseev E.E. LabWork05 #6

Closed
ElEgEv wants to merge 21 commits from LabWork05 into LabWork04
Showing only changes of commit 1ca9dcf5c6 - Show all commits

View File

@ -19,6 +19,8 @@ namespace BlacksmithWorkshopDatabaseImplement.Implements
using var context = new BlacksmithWorkshopDatabase();
var element = context.Orders
.Include(x => x.Manufacture)
.Include(x => x.Client)
.FirstOrDefault(rec => rec.Id == model.Id);
if (element != null)
@ -26,6 +28,7 @@ namespace BlacksmithWorkshopDatabaseImplement.Implements
// для отображения КОРРЕКТНОЙ ViewModel-и
var deletedElement = context.Orders
.Include(x => x.Manufacture)
.Include(x => x.Client)
.FirstOrDefault(x => x.Id == model.Id)
?.GetViewModel;
@ -129,7 +132,10 @@ namespace BlacksmithWorkshopDatabaseImplement.Implements
public OrderViewModel? Update(OrderBindingModel model)
{
using var context = new BlacksmithWorkshopDatabase();
var order = context.Orders.FirstOrDefault(x => x.Id == model.Id);
var order = context.Orders
.Include(x => x.Manufacture)
.Include(x => x.Client)
.FirstOrDefault(x => x.Id == model.Id);
if (order == null)
{