public async Task <IActionResult> CheckAttendance([FromQuery] IdModel model) { var user = await userManager.GetUserAsync(User); if (user == null || !(await userManager.IsInRoleAsync(user, UserHelpers.UserRoles.Staff.ToString()))) { return(Utilities.ErrorJson("Not authorized.")); } if (model.Id == 0) { return(Utilities.GenerateMissingInputMessage("volunteer id")); } try { VolunteerRepository repo = new VolunteerRepository(configModel.ConnectionString); return(new JsonResult(new { DaysAttended = repo.GetAttendanceDates(model.Id) })); } catch (Exception exc) { return(new JsonResult(new { Error = exc.Message, })); } }