public async Task <IActionResult> EditLeague(int leagueId, EditLeagueBindingModel model) { var result = await _leagueService.EditLeagueAsync(leagueId, model); if (result.ErrorOccurred) { return(BadRequest(result)); } return(Ok(result)); }
public async Task <ResponseDto <BaseModelDto> > EditLeagueAsync(int leagueId, EditLeagueBindingModel model) { var response = new ResponseDto <BaseModelDto>(); var league = _leagueRepository.GetById(leagueId); if (league == null) { response.Errors.Add(ServiceErrors.LEAGUE_DOESNT_EXIST); return(response); } league.Name = model.Name; await _leagueRepository.EditAsync(league); return(response); }