public async Task <TeamDTO> EditTeamInfo(TeamEditDTO teamInfo) { using (_unitOfWork) { Team team = await _unitOfWork.TeamRepository.GetTeamWithMembers(teamInfo.TeamId); team.Name = teamInfo.Name; _unitOfWork.TeamRepository.Update(team); await _unitOfWork.Save(); TeamDTO returnTeam = _mapper.Map <Team, TeamDTO>(team); await _messageControllerService.NotifyOnTeamChanges(teamInfo.TeamId, "EditTeamName", _mapper.Map <Team, TeamEditDTO>(team)); return(returnTeam); } }
public async Task <ActionResult> EditTeamInfo([FromBody] TeamEditDTO teamInfo) { try { TeamDTO result = await _teamService.EditTeamInfo(teamInfo); if (result != null) { return(Ok(result)); } return(BadRequest()); } catch (Exception ex) { return(BadRequest(ex.Message)); } }