diff --git a/CarService/CarServiceDatabase/Implements/WorkStorage.cs b/CarService/CarServiceDatabase/Implements/WorkStorage.cs index 4dda831..e4cfa28 100644 --- a/CarService/CarServiceDatabase/Implements/WorkStorage.cs +++ b/CarService/CarServiceDatabase/Implements/WorkStorage.cs @@ -59,7 +59,7 @@ namespace CarServiceDatabase.Implements .Select(w => new ReportWorkWithRequestsViewModel() { WorkName = w.Name, - RepairRequests = GetRepairRequestsByWork(model) + RepairRequests = GetRepairRequestsByWork(context, new() { Id = w.Id }) }) .ToList(); } @@ -68,9 +68,8 @@ namespace CarServiceDatabase.Implements /// /// /// - private List GetRepairRequestsByWork(WorkSearchModel model) + private static List GetRepairRequestsByWork(CarServiceDbContext context, WorkSearchModel model) { - using var context = new CarServiceDbContext(); return context.WorksInRequest .Include(wir => wir.RepairRequest) .ThenInclude(rr => rr.Vehicle)