This commit is contained in:
Jim Paine 2020-04-30 15:46:20 +01:00
Родитель e222170c69
Коммит c33980de1b
1 изменённых файлов: 11 добавлений и 6 удалений

Просмотреть файл

@ -96,13 +96,18 @@ namespace Project.Zap.Controllers
locationIds.AddRange(filteredLocations.Select(x => x.id));
}
IEnumerable <Shift> shifts = await this.shiftRepository.Get(
"SELECT * FROM c WHERE c.StartDateTime >= @startDateTime AND ARRAY_CONTAINS(@locationIds, c.LocationId)",
new Dictionary<string, object>
string sql = "SELECT * FROM c WHERE c.StartDateTime >= @startDateTime";
IDictionary<string, object> parameters = new Dictionary<string, object>
{
{ "@startDateTime", search.Start },
{ "@locationIds", locationIds }
});
{ "@startDateTime", search.Start }
};
if (locationIds.Any())
{
sql = sql + " AND ARRAY_CONTAINS(@locationIds, c.LocationId)";
parameters.Add("@locationIds", locationIds);
}
IEnumerable <Shift> shifts = await this.shiftRepository.Get(sql, parameters);
SearchShiftViewModel viewModel = new SearchShiftViewModel
{