Пример #1
0
        public ActionResult DeleteConfirmed(long id)
        {
            SavdGameState savdGameState = db.SavdGameStates.Find(id);

            db.SavdGameStates.Remove(savdGameState);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #2
0
 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));
 }
Пример #3
0
        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));
        }
Пример #4
0
        // 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));
        }
Пример #5
0
        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));
        }
Пример #6
0
        // 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));
        }