diff --git a/LawFirm/LawFirmDatabaseImplement/Implements/OrderStorage.cs b/LawFirm/LawFirmDatabaseImplement/Implements/OrderStorage.cs index 5fa24a5..d1f1c23 100644 --- a/LawFirm/LawFirmDatabaseImplement/Implements/OrderStorage.cs +++ b/LawFirm/LawFirmDatabaseImplement/Implements/OrderStorage.cs @@ -43,6 +43,8 @@ namespace LawFirmDatabaseImplement.Implements return context.Orders .Include(x => x.Client) .Include(x => x.Implementer) + .Include(x => x.Document) + .Include(x => x.Client) .Where(x => x.ClientId == model.ClientId) .Select(x => x.GetViewModel) .ToList(); @@ -80,7 +82,7 @@ namespace LawFirmDatabaseImplement.Implements using var context = new LawFirmDatabase(); context.Orders.Add(newOrder); 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) diff --git a/LawFirm/LawFirmDatabaseImplement/Models/Order.cs b/LawFirm/LawFirmDatabaseImplement/Models/Order.cs index f74aa49..acbefa6 100644 --- a/LawFirm/LawFirmDatabaseImplement/Models/Order.cs +++ b/LawFirm/LawFirmDatabaseImplement/Models/Order.cs @@ -67,7 +67,6 @@ namespace LawFirmDatabaseImplement.Models public OrderViewModel GetViewModel { get { - var context = new LawFirmDatabase(); return new () {