доработка метода получения отчета по заявкам

This commit is contained in:
Мк Игорь 2023-04-07 20:52:26 +04:00
parent 0a00c532db
commit 148abdfb8e

View File

@ -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
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
private List<ReportRepairRequestViewModel> GetRepairRequestsByWork(WorkSearchModel model)
private static List<ReportRepairRequestViewModel> GetRepairRequestsByWork(CarServiceDbContext context, WorkSearchModel model)
{
using var context = new CarServiceDbContext();
return context.WorksInRequest
.Include(wir => wir.RepairRequest)
.ThenInclude(rr => rr.Vehicle)