private void SaveScore(Score score, string error) { if (Request.IsAuthenticated) { if (((UserGameSession)Session["userGameSession"]).GameSettings.Time == ((UserGameSession)Session["userGameSession"]).gameModule.DefaultTime && ((UserGameSession)Session["userGameSession"]).GameSettings.Answers == ((UserGameSession)Session["userGameSession"]).gameModule.DefaultNumAnswers && ((UserGameSession)Session["userGameSession"]).GameSettings.Questions == ((UserGameSession)Session["userGameSession"]).gameModule.DefaultNumQuestions) { score.UserID = User.Identity.GetUserId(); using (Repos repo = new Repos()) { if (!repo.AddScore(score)) { error = "There was an error saving the score to the database"; } } } else { error = "You must use default settings for your score to save"; } } else { error = "You must be logged in for your score to save"; } }