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