данные для отчетов
This commit is contained in:
parent
20049fb6b7
commit
ddc21a6666
CarCenter
CarCenterContracts/SearchModels
CarCenterDataBaseImplement/Implements
@ -14,6 +14,8 @@ namespace CarCenterContracts.SearchModels
|
||||
public DateTime? InspectionDate { get; set; }
|
||||
public int? AdministratorId { get; set; }
|
||||
public int? EmployeeId { get; set; }
|
||||
|
||||
public DateTime? DateFrom { get; set; }
|
||||
public DateTime? DateTo { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -55,7 +55,20 @@ namespace CarCenterDataBaseImplement.Implements
|
||||
return new();
|
||||
}
|
||||
using var context = new CarCenterDataBase();
|
||||
if (model.AdministratorId.HasValue)
|
||||
if (!model.DateFrom.HasValue && !model.DateTo.HasValue && model.DateFrom.HasValue)
|
||||
{
|
||||
return context.Inspections
|
||||
.Include(x => x.Cars)
|
||||
.ThenInclude(x => x.Car)
|
||||
.ThenInclude(x => x.EquipmentCars)
|
||||
.ThenInclude(x => x.Equipment)
|
||||
.Include(x => x.Employee)
|
||||
.Include(x => x.Administrator)
|
||||
.Where(x => x.InspectionDate >= model.DateFrom && x.InspectionDate <= model.DateTo && x.AdministratorId == model.AdministratorId)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
else if(model.AdministratorId.HasValue)
|
||||
{
|
||||
return context.Inspections
|
||||
.Include(x => x.Cars)
|
||||
|
Loading…
x
Reference in New Issue
Block a user