Фикс фильтрации диагнозов по датам

This commit is contained in:
Никита Потапов 2024-05-01 11:58:10 +04:00
parent ac12c85d7d
commit 7d5c2e2cf5

View File

@ -50,11 +50,18 @@ namespace PolyclinicDatabaseImplement.Implements
} }
if (model.To != null) if (model.To != null)
{ {
elements = elements elements = elements.Where(x => x.DateStartDiagnose <= model.To.Value).ToList();
.Where(x => x.DateStartDiagnose <= model.To.Value)
var elemWithDateStop = elements
.Where(x => x.DateStopDiagnose != null) .Where(x => x.DateStopDiagnose != null)
.Where(x => x.DateStopDiagnose <= model.To.Value) .Where(x => x.DateStopDiagnose <= model.To.Value)
.ToList(); .ToList();
var elemWithoutDateStop = elements.Where(x => x.DateStopDiagnose == null).ToList();
elemWithDateStop.AddRange(elemWithoutDateStop);
elements = elemWithDateStop;
} }
return elements; return elements;
} }