public async Task <IActionResult> GetEventRuns([FromQuery] int eventId) { var response = new ListModelResponse <Run>() as IListModelResponse <Run>; try { if (eventId < 1) { throw new Exception("Event Id is missing"); } response.Model = await Task.Run(() => { IEnumerable <Run> run = _context.GetEventRuns(eventId); 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 GetEventRuns(int eventId) { IEnumerable <Run> runs = _runRepo.GetEventRuns(eventId); if (runs == null) { return(NoContent()); } return(Json(runs)); }