Example #1
0
 //
 // GET: /Game/Create
 public ActionResult Create(string input)
 {
     if (input == null)
     {
         return RedirectToAction("Home");
     }
     Game game = new Game();
     game.gameType = db.GetGameTypeByName(input);
     game.gameActive = true;
     game.gameName = game.gameType.gameTypeName + " " + db.GetAllGameByGameType(input).Count();
     db.InsertGame(game);
     return RedirectToAction("Play", game);
 }
Example #2
0
 internal void SaveChanges(Game game)
 {
     throw new NotImplementedException();
 }
Example #3
0
 /// <summary>
 /// Updates game 
 /// </summary>
 /// <param name="game"></param>
 public void UpdateGame(Game game)
 {
     context.Entry(game).State = EntityState.Modified;
     context.SaveChanges();
 }
Example #4
0
 /// <summary>
 /// 
 /// </summary>
 public void SaveGame(Game game)
 {
     context.SaveChanges(game);
 }
Example #5
0
 /// <summary>
 /// Insert game (instance)
 /// </summary>
 /// <param name="game"></param>
 public void InsertGame(Game game)
 {
     context.Games.Add(game);
     context.SaveChanges();
 }
Example #6
0
 void IGameRepository.UpdateGame(Game game)
 {
     throw new NotImplementedException();
 }
Example #7
0
 void IGameRepository.InsertGame(Game game)
 {
     throw new NotImplementedException();
 }
Example #8
0
 public ActionResult Play(Game game)
 {
     if (game == null)
     {
         return RedirectToAction("Home");
     }
     if (User.Identity.IsAuthenticated.Equals(false))
     {
         RedirectToAction("Login");
     }
     model.GameInstance = db.GetGameByID(game.gameID);
     model.GameTypeInstance = (from t in db.GetGameType()
                               where t.gameTypeID == model.GameInstance.gameType.gameTypeID
                               select t).SingleOrDefault();
     return View(model);
 }
Example #9
0
 public ActionResult Edit(Game game)
 {
     if (ModelState.IsValid)
     {
         db.UpdateGame(game);
         //db.Entry(game).State = EntityState.Modified;
         db.SaveGame(game);
         //GameRepository.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(game);
 }