public async Task <IActionResult> Edit([FromRoute] int id, [FromBody] Match match) { try { if ((id != match.MatchId) || (match.HomeTeamId == match.GuestTeamId)) { return(Conflict()); } if (!ModelState.IsValid) { return(BadRequest(ModelState)); } await matchService.EditMatchAsync(match); return(Accepted()); } catch (ArgumentException) { return(StatusCode(429)); } catch (AmbiguousMatchException) { return(StatusCode(431)); } catch (NotFoundInDatabaseException) { return(NotFound()); } catch (Exception e) { return(BadRequest(e.Message)); } }
public async Task <IActionResult> EditMatch(int matchId, EditMatchBindingModel model) { var result = await _matchService.EditMatchAsync(matchId, model); if (result.ErrorOccurred) { return(BadRequest(result)); } return(Ok(result)); }