public ActionResult Game(GameInstance gameInstance)
        {
            var players = _dataRepository.GameInstanceRepository.GetUsersByGameInstance(gameInstance.GameInstanceID);
            var game = _dataRepository.GameRepository.Find(gameInstance.GameID);
            var viewModel = new GameInstanceViewModel {GameInstance = gameInstance, Players = players, Game = game};

            return View(viewModel);
        }
 public ActionResult Join(GameInstance gameInstance)
 {
     if (WebSecurity.IsAuthenticated)
     {
         //var gameInstance = _dataRepository.GameInstanceRepository.Find(gameInstance);
         _dataRepository.GameInstanceRepository.JoinGameInstance(gameInstance, WebSecurity.CurrentUserId);
         return RedirectToAction("Game", gameInstance);
     }
     return RedirectToAction("Login", "Account");
 }
 public ActionResult DeleteGameInstance(GameInstance gameInstance)
 {
     _dataRepository.GameInstanceRepository.DeleteGameInstance(gameInstance.GameInstanceID);
     _dataRepository.GameInstanceRepository.Save();
     return RedirectToAction("Index", "Home");
 }
 public void ActivateGameInstance(GameInstance gameInstance)
 {
     _dataRepository.GameInstanceRepository.ActivateGameInstance(gameInstance.GameInstanceID);
     _dataRepository.GameInstanceRepository.Save();
 }