示例#1
0
        public async Task <GamesView> ChangeState(Game game, byte stateId)
        {
            try
            {
                game.GameStateId = stateId;
                _wargameContext.Update(game);
                await _wargameContext.SaveChangesAsync();

                return(_wargameContext.GamesView.SingleOrDefault(x => x.Player1Id == game.Player1Id && x.Player2Id == game.Player2Id));
            }
            catch (Exception e)
            {
                throw new Exception("Error in friend's acceptation request : " + e.Message);
            }
        }
示例#2
0
        public async Task <bool> setTouched(Position positon, bool touched = true)
        {
            try
            {
                positon.Touche = touched;
                _wargameContext.Update(positon);
                await _wargameContext.SaveChangesAsync();

                return(true);
            }
            catch (Exception e)
            {
                throw new Exception("Error in friend's acceptation request : " + e.Message);
            }
        }
示例#3
0
        public async Task <FriendsView> Update(Friends friend)
        {
            try
            {
                friend.Indemand = true;
                _wargameContext.Update(friend);
                await _wargameContext.SaveChangesAsync();

                return(_wargameContext.FriendsView.SingleOrDefault(x => x.Id1 == friend.UserId1 && x.Id2 == friend.UserId2));
            }
            catch (Exception e)
            {
                throw new Exception("Erreur lors de l'acceptation de la demande : " + e.Message);
            }
        }