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