public async Task DeleteSquadAsync(Guid id, CancellationToken cancellationToken) { var squad = await _squadRepository.GetAsync(id, cancellationToken); var updated = squad.Delete(); if (updated) { _squadRepository.Update(squad); await _squadRepository.SaveAsync(cancellationToken); } }
public async Task <Entities.Squad> CreateTeamAsync( string name, Guid teamOwnerId, Guid squadId, string description, CancellationToken cancellationToken) { var squad = await _squadRepository.GetAsync(squadId, cancellationToken) ?? throw new Exception(); squad.AddTeam(name, teamOwnerId, description); return(squad); }
public async Task <Models.Squad> GetOrCreateAsync(string userId) { var activeSquad = await _squadRepository.GetAsync(userId); //if(activeSquad != null) //{ // var cardIds = activeSquad.Lineup.Where(x => x.Value.HasValue).Select(x => x.Value).Cast<Guid>() // .Concat(activeSquad.Subs.Where(x => x != null).Select(x => x.Value)).ToList(); //TODO move out // var request = new GetCardsRequest(cardIds); // var response = await _bus.RequestAsync<GetCardsRequest, GetCardsResponse>(request); // activeSquad.Cards = _mapper.Map<IList<Card>>(response.Cards); //} return(activeSquad ?? await _squadRepository.CreateAsync(userId)); }
public async Task <PaginatedList <Squad> > GetAsync(SquadQuery squadQuery) { return(await _squadRepository.GetAsync(squadQuery)); }