public async Task <ActionResult> AddTeams(Guid groupId, [FromBody] AddTeams command) { command.GroupId = groupId; command.UserId = User.GetUserId(); await _teamService.AddTeams(command); return(Ok()); }
public async Task AddTeams(AddTeams command) { await _administratorService.ValidateAtLeastModerator(command.UserId, command.GroupId); var group = await _groupRepository.GetWithTeamsAsync(command.GroupId); var teams = command.TeamNames.Select(tn => new Team(tn)); group.AddTeams(teams); await _groupRepository.SaveChangesAsync(); }