public ActionResult Create(Statistic statistic)
 {
     if (ModelState.IsValid)
     {
         _dataRepository.StatisticRepository.InsertOrUpdate(statistic);
         _dataRepository.StatisticRepository.Save();
         return RedirectToAction("Index");
     }
     ViewBag.PossibleUsers = _dataRepository.UserRepository.All;
     ViewBag.PossibleGames = _dataRepository.GameRepository.All;
     return View();
 }
        public void SaveWinOrLoss(string userId, string gameId, string winOrLoose)
        {
            var myStat = _dataRepository.StatisticRepository.FindByUserIdAndGameID(Convert.ToInt32(userId), Convert.ToInt32(gameId));
            if (myStat == null)
            {
                myStat = new Statistic
                             {
                                 UserID = Convert.ToInt32(userId),
                                 GameID = Convert.ToInt32(gameId),
                                 GamesPlayed = 1,
                                 Points = 0
                             };
               // myStat.Id = 0;

                switch (winOrLoose)
                {
                    case "Won":
                        myStat.Wins = 1;
                        myStat.Losses = 0;
                        myStat.Draws = 0;
                        break;
                    case "Lost":
                        myStat.Wins = 0;
                        myStat.Losses = 1;
                        myStat.Draws = 0;
                        break;
                    case "Tie":
                        myStat.Wins = 0;
                        myStat.Losses = 0;
                        myStat.Draws = 1;
                        break;
                }
            }
            else if (myStat != null)
            {
                myStat.GamesPlayed += 1;
                switch (winOrLoose)
                {
                    case "Won":
                        myStat.Wins += 1;
                        break;
                    case "Lost":
                        myStat.Losses += 1;
                        break;
                    case "Tie":
                        myStat.Draws += 1;
                        break;
                }
            }
            _dataRepository.StatisticRepository.InsertOrUpdate(myStat);
            _dataRepository.StatisticRepository.Save();
        }