public ActionResult DeleteConfirmed(long id) { SavdGameState savdGameState = db.SavdGameStates.Find(id); db.SavdGameStates.Remove(savdGameState); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,GameId,UserId,Saved,Progress")] SavdGameState savdGameState) { if (ModelState.IsValid) { db.Entry(savdGameState).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.GameId = new SelectList(db.Games, "Id", "Id", savdGameState.GameId); ViewBag.UserId = new SelectList(db.Users, "Id", "UserName", savdGameState.UserId); return(View(savdGameState)); }
public ActionResult Create([Bind(Include = "Id,GameId,UserId,Saved,Progress")] SavdGameState savdGameState) { if (ModelState.IsValid) { db.SavdGameStates.Add(savdGameState); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.GameId = new SelectList(db.Games, "Id", "Id", savdGameState.GameId); ViewBag.UserId = new SelectList(db.Users, "Id", "UserName", savdGameState.UserId); return(View(savdGameState)); }
// GET: SavdGameStates/Details/5 public ActionResult Details(long?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } SavdGameState savdGameState = db.SavdGameStates.Find(id); if (savdGameState == null) { return(HttpNotFound()); } return(View(savdGameState)); }
public ActionResult SaveGame(int game_id, string user_id, int progress) { int records = 0; using (var context = new IslandEscapeOfficialEntities()) { var new_game_state = new SavdGameState { GameId = game_id, UserId = user_id, Progress = progress, Saved = DateTime.Now }; context.SavdGameStates.Add(new_game_state); records = context.SaveChanges(); } return(Json(records)); }
// GET: SavdGameStates/Edit/5 public ActionResult Edit(long?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } SavdGameState savdGameState = db.SavdGameStates.Find(id); if (savdGameState == null) { return(HttpNotFound()); } ViewBag.GameId = new SelectList(db.Games, "Id", "Id", savdGameState.GameId); ViewBag.UserId = new SelectList(db.Users, "Id", "UserName", savdGameState.UserId); return(View(savdGameState)); }