private static ICommand CreateCommandToUpdateMembership(int teamId, string idOfUserToUpdate, UserMembershipStatus newMembershipStatus) { ICommand command = null; if (newMembershipStatus == UserMembershipStatus.Removed) { command = new RemoveUserFromTeamCommand(idOfUserToUpdate, teamId); } else { command = new UpdateMembershipStatusCommand(idOfUserToUpdate, teamId, Mapper.Map <UserMembershipStatus, MembershipStatus>( newMembershipStatus)); } return(command); }
public async Task <Unit> RemoveUserFromTeam([FromRoute] int teamId, [FromBody] RemoveUserFromTeamCommand command) { return(await _mediator.Send(command)); }