public async Task <IActionResult> GetRun([FromQuery] int runId) { var response = new SingleModelResponse <Run>() as ISingleModelResponse <Run>; try { if (runId < 1) { throw new Exception("Run Id is missing"); } response.Model = await Task.Run(() => { Run run = _context.GetRunByID(runId); 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 GetRun(int runId) { Run run = _runRepo.GetRunByID(runId); if (run == null) { return(NotFound()); } return(Json(run)); }