Exemplo n.º 1
0
        public void Handle(UpdateTeamName message)
        {
            var team = _repository.Find(message.TeamId);

            team.UpdateName(message.NewName);
            _repository.Save(team, message.OriginalVersion);
        }
Exemplo n.º 2
0
        public async Task UpdateTeamName(UpdateTeamName command)
        {
            await _administratorService.ValidateAtLeastModerator(command.UserId, command.GroupId);

            var group = await _groupRepository.GetWithTeamsAsync(command.GroupId);

            group.UpdateTeamName(command.TeamName, command.NewTeamName);

            await _groupRepository.SaveChangesAsync();
        }
Exemplo n.º 3
0
        public IActionResult UpdateName(Guid id, [FromBody] UpdateTeamName model)
        {
            if (model == null)
            {
                return(BadRequest());
            }

            _bus.Send(new commands.UpdateTeamName(id, model.NewName, model.OriginalVersion));

            return(CreatedAtRoute(nameof(GetById), new { controller = nameof(Team), id = id }, model));
        }
Exemplo n.º 4
0
        public async Task <ActionResult> UpdateTeamName(Guid groupId, string teamName, [FromBody] UpdateTeamName command)
        {
            command.GroupId  = groupId;
            command.UserId   = User.GetUserId();
            command.TeamName = teamName;
            await _teamService.UpdateTeamName(command);

            return(Ok());
        }