public void deleteScore(Models.Scorecard scorecard) { ScoreRepository repo = new ScoreRepository(); repo.HardDelete(scorecard.ID); repo.Save(); SendTeamScoreUpdate(scorecard.TeamID); SendLeaderboardUpdate(); }
public void saveScore(Models.Scorecard scorecard) { ScoreRepository repo = new ScoreRepository(); Score score = new Score() { HoleID = scorecard.HoleID, Value = scorecard.Value, TeamID = scorecard.TeamID, DateUpdated = DateTime.Now, DateInserted = scorecard.ID == 0 ? DateTime.Now : scorecard.DateInserted, ID = scorecard.ID }; repo.InsertOrUpdate(score); repo.Save(); SendTeamScoreUpdate(score.TeamID); SendLeaderboardUpdate(); }
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(); }