public async Task <IActionResult> PutAsync(Guid id, [FromBody] RoundInputModel model) { if (default(Guid).Equals(id)) { AddNotification("O Id da rodada não foi informado."); return(ResponseInvalid()); } if (ModelState.IsValid) { var round = new Round(model.Description, model.Date, model.RankingId); await _roundService.UpdateAsync(id, round); if (ValidOperation()) { return(NoContent()); } return(ResponseInvalid()); } NotifyModelStateError(); return(ResponseInvalid()); }
public async Task <IActionResult> PostAsync([FromBody] RoundInputModel model) { if (ModelState.IsValid) { var round = new Round(model.Description, model.Date, model.RankingId); await _roundService.AddAsync(round); if (ValidOperation()) { return(Created(GetRouteById(round.Id), new { id = round.Id })); } return(ResponseInvalid()); } NotifyModelStateError(); return(ResponseInvalid()); }