public async Task <IActionResult> UpdateSquadAsync( [FromRoute] Guid squadId, [FromBody] UpdateSquadCommand updateSquadCommand, CancellationToken cancellationToken) { updateSquadCommand.SquadId = squadId; await _squadHandler.UpdateSquadAsync(updateSquadCommand, cancellationToken); return(Ok()); }
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); } }