BackReport

This commit is contained in:
Sergey Kozyrev 2024-05-01 15:38:13 +04:00
parent 3cbab2be56
commit e19fa68a6b

View File

@ -35,7 +35,9 @@ namespace DatabaseImplement.Implements
return new(); return new();
} }
using var context = new FactoryGoWorkDatabase(); using var context = new FactoryGoWorkDatabase();
if (model.DateFrom.HasValue) if (model.DetailId.HasValue)
return context.Workshops.Where(x => x.ProductionId.HasValue).Include(x => x.Production).Where(x => x.Production.Details.FirstOrDefault(y => y.DetailId == model.DetailId) != null).Where(x => x.UserId == model.UserId).Select(x => x.GetViewModel).ToList();
else if (model.DateFrom.HasValue)
return context.Workshops.Where(x => x.UserId == model.Id).Where(x => x.DateCreate < model.DateTo && x.DateCreate > model.DateFrom).Select(x => x.GetViewModel).ToList(); return context.Workshops.Where(x => x.UserId == model.Id).Where(x => x.DateCreate < model.DateTo && x.DateCreate > model.DateFrom).Select(x => x.GetViewModel).ToList();
else else
return context.Workshops.Where(x => x.UserId == model.Id).Select(x => x.GetViewModel).ToList(); return context.Workshops.Where(x => x.UserId == model.Id).Select(x => x.GetViewModel).ToList();