Exemplo n.º 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);
 }
Exemplo n.º 2
0
 internal void SaveChanges(Game game)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 3
0
 /// <summary>
 /// Updates game 
 /// </summary>
 /// <param name="game"></param>
 public void UpdateGame(Game game)
 {
     context.Entry(game).State = EntityState.Modified;
     context.SaveChanges();
 }
Exemplo n.º 4
0
 /// <summary>
 /// 
 /// </summary>
 public void SaveGame(Game game)
 {
     context.SaveChanges(game);
 }
Exemplo n.º 5
0
 /// <summary>
 /// Insert game (instance)
 /// </summary>
 /// <param name="game"></param>
 public void InsertGame(Game game)
 {
     context.Games.Add(game);
     context.SaveChanges();
 }
Exemplo n.º 6
0
 void IGameRepository.UpdateGame(Game game)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 7
0
 void IGameRepository.InsertGame(Game game)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 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);
 }
Exemplo n.º 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);
 }