private void AddScore(int gameId, string userId, int drinks) { Score score = scoreRepo.getByGameAndUser(gameId, userId); if (score == null) { scoreRepo.Add(new Score() { gameId = gameId, userId = userId, score1 = drinks }); } else { score.score1 += drinks; scoreRepo.Update(score); } scoreRepo.Save(); }