public async Task <IActionResult> ChildrenByBusForDay([FromQuery] DateModel Date) { var user = await userManager.GetUserAsync(User); if (user == null || !(await userManager.IsInRoleAsync(user, UserHelpers.UserRoles.Staff.ToString())) || await userManager.IsInRoleAsync(user, UserHelpers.UserRoles.BusDriver.ToString())) { return(Utilities.ErrorJson("Not authorized.")); } try { AnalyticsRepository repo = new AnalyticsRepository(configModel.ConnectionString); return(new JsonResult(new { ChildrenByBus = repo.GetChildrenByBusForDay(Date) })); } catch (Exception exc) { return(new JsonResult(new { Error = exc.Message, })); } }