доработка с отчётом
This commit is contained in:
parent
c280252ed7
commit
4bb7a85a9d
@ -415,7 +415,6 @@ namespace AdministratorApp.Controllers
|
||||
InspectionBindingModel InspectionBinding = new() { Id = InspectionId, InspectionCost = Inspection.InspectionCost, InspectionName = Inspection.InspectionName, AdministratorId = Inspection.AdministratorId, InspectionCars = Inspection.InspectionCars, EmployeeId = EmployeeId };
|
||||
_data.UpdateInspection(InspectionBinding);
|
||||
return RedirectToAction("IndexInspection");
|
||||
|
||||
}
|
||||
|
||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||
|
@ -29,15 +29,15 @@ namespace CarCenterDataBaseImplement.Implements
|
||||
|
||||
public List<EmployeeViewModel> GetFilteredList(EmployeeSearchModel model)
|
||||
{
|
||||
if (!model.ManagerId.HasValue && !model.DateFrom.HasValue && !model.DateTo.HasValue)
|
||||
if (!model.ManagerId.HasValue && !model.SaleId.HasValue)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
using var context = new CarCenterDataBase();
|
||||
if (model.DateFrom.HasValue)
|
||||
return context.Employees.Where(x => x.ManagerId == model.ManagerId).Where(x => x.DateCreate <= model.DateTo && x.DateCreate >= model.DateFrom).Select(x => x.GetViewModel).ToList();
|
||||
if (model.SaleId.HasValue)
|
||||
return context.Employees.Include(x => x.Sales).ThenInclude(x => x.Sale).Where(x => x.ManagerId == model.ManagerId).Where(x => x.Sales.FirstOrDefault(y => y.SaleId == model.SaleId) != null).Include(x => x.Manager).Select(x => x.GetViewModel).ToList();
|
||||
else
|
||||
return context.Employees.Where(x => x.ManagerId == model.ManagerId).Select(x => x.GetViewModel).ToList();
|
||||
return context.Employees.Include(x => x.Sales).ThenInclude(x => x.Sale).Where(x => x.ManagerId == model.ManagerId).Select(x => x.GetViewModel).ToList();
|
||||
}
|
||||
|
||||
public List<EmployeeViewModel> GetFullList()
|
||||
|
@ -28,9 +28,9 @@ namespace CarCenterDataBaseImplement.Models
|
||||
public virtual Employee? Employee { get; set; }
|
||||
|
||||
[ForeignKey("InspectionId")]
|
||||
public virtual List<InspectionCar> Cars { get; set; }
|
||||
public virtual List<InspectionCar> Cars { get; set; } = new();
|
||||
|
||||
private Dictionary<int, ICarSalesModel>? _inspectionCars = null;
|
||||
private Dictionary<int, ICarSalesModel> _inspectionCars = null;
|
||||
|
||||
[NotMapped]
|
||||
public Dictionary<int, ICarSalesModel> InspectionCars
|
||||
|
@ -157,7 +157,7 @@ namespace ManagerApp
|
||||
SalesInspectionsReportViewModel report = new();
|
||||
var sale = _SaleLogic.ReadElement(new() { Id = i });
|
||||
report.SaleName = sale!.SaleName;
|
||||
var inspections = _inspectionLogic.ReadList(new() { CarSalesId = i });
|
||||
var inspections = _inspectionLogic.ReadList(new() { SalesId = i });
|
||||
if (inspections != null)
|
||||
report.Inspections = inspections.Select(w => w.InspectionName).ToList();
|
||||
reports.Add(report);
|
||||
|
Loading…
Reference in New Issue
Block a user