public IActionResult UpdateAthlete(Athlete athlete) { if (ModelState.IsValid) { _context.UpdateAthlete(athlete); _context.SaveAthlete(); return(Ok(athlete.AthleteId)); } else { return(BadRequest()); } }
public async Task <IActionResult> UpdateAthlete([FromBody] Athlete athlete) { var response = new SingleModelResponse <Athlete>() as ISingleModelResponse <Athlete>; try { if (athlete == null) { throw new Exception("Model is missing"); } response.Model = await Task.Run(() => { return(_context.UpdateAthlete(athlete)); }); } catch (Exception ex) { response.DidError = true; response.ErrorMessage = ex.Message; } return(response.ToHttpResponse()); }