This commit is contained in:
Данила Мочалов 2023-04-10 10:39:35 +04:00
commit 42ebe7410b
2 changed files with 3 additions and 2 deletions

View File

@ -43,6 +43,8 @@ namespace LawFirmDatabaseImplement.Implements
return context.Orders return context.Orders
.Include(x => x.Client) .Include(x => x.Client)
.Include(x => x.Implementer) .Include(x => x.Implementer)
.Include(x => x.Document)
.Include(x => x.Client)
.Where(x => x.ClientId == model.ClientId) .Where(x => x.ClientId == model.ClientId)
.Select(x => x.GetViewModel) .Select(x => x.GetViewModel)
.ToList(); .ToList();
@ -80,7 +82,7 @@ namespace LawFirmDatabaseImplement.Implements
using var context = new LawFirmDatabase(); using var context = new LawFirmDatabase();
context.Orders.Add(newOrder); context.Orders.Add(newOrder);
context.SaveChanges(); context.SaveChanges();
return context.Orders.Include(x => x.Document).FirstOrDefault(x => x.Id == newOrder.Id)?.GetViewModel; return context.Orders.Include(x => x.Document).Include(x => x.Client).FirstOrDefault(x => x.Id == newOrder.Id)?.GetViewModel;
} }
public OrderViewModel? Update(OrderBindingModel model) public OrderViewModel? Update(OrderBindingModel model)

View File

@ -67,7 +67,6 @@ namespace LawFirmDatabaseImplement.Models
public OrderViewModel GetViewModel { public OrderViewModel GetViewModel {
get get
{ {
var context = new LawFirmDatabase();
return new () return new ()
{ {