Beispiel #1
0
        public async Task <bool> RemoveCollaboratorAsync(int gameId, DbEntity_User user)
        {
            var game = await GetByIdAsync(gameId);

            var success = await RemoveCollaboratorAsync(gameId, user);

            return(success);
        }
Beispiel #2
0
        public async Task <bool> RemoveCollaboratorAsync(DbEntity_Game game, DbEntity_User user)
        {
            var collaborator = await GetCollaboratorAsync(game.GameId, user.UserId);

            var success = await RemoveCollaboratorAsync(collaborator);

            return(success);
        }
Beispiel #3
0
        public async Task <List <DbEntity_Officer> > GetByUserAsync(DbEntity_User user)
        {
            var officers = await _ksuGdcContext.Officers
                           .Where(o => o.UserId == user.UserId)
                           .ToListAsync();

            return(officers);
        }
Beispiel #4
0
        public async Task <List <DbEntity_Game> > GetGamesAsync(DbEntity_User user)
        {
            var games = await _ksuGdcContext.GameUsers
                        .Where(gu => gu.UserId == user.UserId)
                        .Include(gu => gu.Game)
                        .Select(gu => gu.Game)
                        .ToListAsync();

            return(games);
        }
Beispiel #5
0
        public async Task <bool> AddCollaboratorAsync(DbEntity_Game game, DbEntity_User user)
        {
            var collaborator = new DbEntity_GameUser()
            {
                GameId = game.GameId,
                UserId = user.UserId
            };
            var success = await AddCollaboratorAsync(collaborator);

            return(success);
        }
Beispiel #6
0
        public async Task <DbEntity_Image> GetImageAsync(DbEntity_User user)
        {
            var image = await _ksuGdcContext.UserImages
                        .Where(ui => ui.UserId == user.UserId)
                        .Select(ui => ui.Image)
                        .FirstOrDefaultAsync();

            if (image == null)
            {
                throw new NotFoundException($"No image with user id '{user.UserId}' was found.");
            }
            return(image);
        }
Beispiel #7
0
        public async Task <bool> CreateAsync(DbEntity_User createdUser)
        {
            await _ksuGdcContext.Users.AddAsync(createdUser);

            return(true);
        }
Beispiel #8
0
 public async Task <bool> UpdateAsync(DbEntity_User updatedUser)
 {
     _ksuGdcContext.Update(updatedUser);
     return(true);
 }