public async Task <ActionResult <TeamMemberResult> > UpdateTeamMember(string memberId, [FromBody] TeamMember teamMember) { if (string.IsNullOrEmpty(memberId)) { return(BadRequest(nameof(memberId))); } teamMember.TeamId = teamId; var updatedMemberId = await client.Send(new SaveTeamMemberCommand { Member = mapper.Map <ESS.Shared.Contracts.Team.TeamMember>(teamMember) }); if (updatedMemberId == null) { return(NotFound(updatedMemberId)); } return(Ok(new TeamMemberResult { Id = updatedMemberId })); }
public async Task <ActionResult <TeamMemberResult> > UpdateTeamMember(string memberId, [FromBody] TeamMember teamMember) { try { teamMember.Id = memberId; teamMember.TeamId = teamId; var member = mapper.Map <ESS.Shared.Contracts.Teams.TeamMember>(teamMember); var updatedMemberId = await client.Send(new SaveTeamMemberCommand { Member = mapper.Map <ESS.Shared.Contracts.Teams.TeamMember>(teamMember) }); return(Ok(new TeamMemberResult { Id = updatedMemberId })); } catch (NotFoundException) { return(NotFound(memberId)); } catch (UsernameAlreadyExistsException e) { return(BadRequest(e.UserName)); } }