コード例 #1
0
 internal static async Task <bool> CheckIfPlayerIsAlreadyInATeamWithTheSameFormat(string playerId, int formatId, IDeletableEntityRepository <PlayerTeam> playerTeamsRepository)
 {
     return(await playerTeamsRepository
            .AllAsNoTrackingWithDeleted()
            .Include(pt => pt.Team)
            .Where(pt => pt.PlayerId == playerId && !pt.IsDeleted)
            .AnyAsync(pt => pt.Team.TournamentFormatId == formatId));
 }
コード例 #2
0
        public async Task Update(ReviewInputModel input)
        {
            var review = reviewsRepository.AllAsNoTrackingWithDeleted().FirstOrDefault(x => x.Id == input.Id);

            if (review == null)
            {
                throw new InvalidOperationException("The review could not be found");
            }

            review = AutoMapperConfig.MapperInstance.Map <Review>(input);

            reviewsRepository.Update(review);
            await reviewsRepository.SaveChangesAsync();
        }
コード例 #3
0
        public async Task <int> Update(GenreInputModel input)
        {
            var genre = genresRepository.AllAsNoTrackingWithDeleted().FirstOrDefault(x => x.Id == input.Id);

            if (genre == null)
            {
                throw new InvalidOperationException("The genre could not be found");
            }

            genre = AutoMapperConfig.MapperInstance.Map <Genre>(input);

            genresRepository.Update(genre);
            await genresRepository.SaveChangesAsync();

            return(input.Id);
        }
コード例 #4
0
        public async Task <int> Update(GameInputModel input)
        {
            var game = gamesRepository.AllAsNoTrackingWithDeleted().FirstOrDefault(x => x.Id == input.Id);

            if (game == null)
            {
                throw new InvalidOperationException("The game could not be found");
            }

            game = AutoMapperConfig.MapperInstance.Map <Game>(input);

            gamesRepository.Update(game);
            await gamesRepository.SaveChangesAsync();

            // TODO: Fix Update of Genres
            //await genresService.RelateGameWithGenres(game.Id, input.GenreIds);
            return(input.Id);
        }