public async Task <IActionResult> EditTeam(int teamId, [FromBody] EditTeamBindingModel model) { var result = await _teamService.EditTeamsync(teamId, model); if (result.ErrorOccurred) { return(BadRequest(result)); } return(Ok(result)); }
public async Task <ResponseDto <BaseModelDto> > EditTeamsync(int teamId, EditTeamBindingModel model) { var response = new ResponseDto <BaseModelDto>(); var team = _teamRepository.GetById(teamId); if (team == null) { response.Errors.Add(ServiceErrors.TEAM_DOESNT_EXIST); return(response); } team.Name = model.Name; await _teamRepository.EditAsync(team); return(response); }
public EditTeamBindingModel GetEditModel(int id) { var team = this.Context .Teams .FirstOrDefault(a => a.Id == id); if (team == null) { return(null); } var model = new EditTeamBindingModel { Id = team.Id, Name = team.Name, LogoUrl = team.LogoUrl }; return(model); }
public ActionResult Edit(EditTeamBindingModel model) { this.teams.Edit(model.Id, model.Name, model.LogoUrl); return(this.RedirectToAction("All", "Teams", new { area = "" })); }