public async Task <IActionResult> GetTotalDistanceRan([FromQuery] int athleteId) { var response = new SingleModelResponse <double>() as ISingleModelResponse <double>; try { if (athleteId < 1) { throw new Exception("Athlete Id is missing"); } response.Model = await Task.Run(() => { double distance = -1; distance = _context.GetTotalDistanceRan(athleteId); if (distance < 0) { throw new Exception("Run does not exist"); } return(distance); }); } catch (Exception ex) { response.DidError = true; response.ErrorMessage = ex.Message; } return(response.ToHttpResponse()); }