예제 #1
0
        public async Task <IActionResult> UpdateSquadAsync(
            [FromRoute] Guid squadId,
            [FromBody] UpdateSquadCommand updateSquadCommand,
            CancellationToken cancellationToken)
        {
            updateSquadCommand.SquadId = squadId;

            await _squadHandler.UpdateSquadAsync(updateSquadCommand, cancellationToken);

            return(Ok());
        }
예제 #2
0
        public async Task UpdateSquadAsync(
            UpdateSquadCommand updateSquadCommand,
            CancellationToken cancellationToken)
        {
            var squad = await _squadRepository.GetAsync(updateSquadCommand.SquadId, cancellationToken);

            var isUpdated = squad.UpdateName(updateSquadCommand.Name);

            isUpdated = squad.UpdateSquadOwnerId(updateSquadCommand.SquadOwnerId);

            if (isUpdated)
            {
                _squadRepository.Update(squad);
                await _squadRepository.SaveAsync(cancellationToken);
            }
        }