public async Task <IActionResult> GetAthletePersonalRuns([FromQuery] int athleteId) { var response = new ListModelResponse <Run>() as IListModelResponse <Run>; try { if (athleteId < 1) { throw new Exception("Athlete Id is missing"); } response.Model = await Task.Run(() => { IEnumerable <Run> run = _context.GetAthletePersonalRuns(athleteId); if (run == null) { throw new Exception("Run does not exist"); } return(run); }); } catch (Exception ex) { response.DidError = true; response.ErrorMessage = ex.Message; } return(response.ToHttpResponse()); }
public IActionResult GetAthletePersonalRuns(int athleteId) { IEnumerable <Run> runs = _runRepo.GetAthletePersonalRuns(athleteId); if (runs == null) { return(NoContent()); } return(Json(runs)); }