示例#1
0
 public ActionResult DeleteConfirmed(int id)
 {
     OwnGame ownGame = db.OwnGames.Find(id);
     db.OwnGames.Remove(ownGame);
     db.SaveChanges();
     return RedirectToAction("Index");
 }
示例#2
0
 public ActionResult Edit([Bind(Include = "OwnGameID,Email,GameID")] OwnGame ownGame)
 {
     if (ModelState.IsValid)
     {
         db.Entry(ownGame).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.GameID = new SelectList(db.Games, "GameID", "Title", ownGame.GameID);
     ViewBag.Email = new SelectList(db.Users, "Email", "Password", ownGame.Email);
     return View(ownGame);
 }
示例#3
0
 public ActionResult Details(int? id)
 {
     if (id == null)
     {
         return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
     }
     OwnGame ownGame = db.OwnGames.Find(id);
     if (ownGame == null)
     {
         return HttpNotFound();
     }
     return View(ownGame);
 }
示例#4
0
        public ActionResult Create([Bind(Include = "OwnGameID,Email,GameID")] OwnGame ownGame)
        {
            if (ModelState.IsValid)
            {
                db.OwnGames.Add(ownGame);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.GameID = new SelectList(db.Games, "GameID", "Title", ownGame.GameID);
            ViewBag.Email = new SelectList(db.Users, "Email", "Password", ownGame.Email);
            //return RedirectToAction("EmptyCart");
            return View(ownGame);
        }
示例#5
0
 public ActionResult Edit(int? id)
 {
     if (id == null)
     {
         return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
     }
     OwnGame ownGame = db.OwnGames.Find(id);
     if (ownGame == null)
     {
         return HttpNotFound();
     }
     ViewBag.GameID = new SelectList(db.Games, "GameID", "Title", ownGame.GameID);
     ViewBag.Email = new SelectList(db.Users, "Email", "Password", ownGame.Email);
     return View(ownGame);
 }
示例#6
0
        public ActionResult Create(Checkout checkout, string userEmail)
        {
            List<int> GameIDs = new List<int>();
            GameIDs = (List<int>)TempData["CheckoutGameIDs"];
            ViewBag.Email = userEmail;

            for (int i = 0; i < GameIDs.Count; i++)
            {
                ViewBag.GameID = GameIDs[i];
                OwnGame ownedGames = new OwnGame();
                ownedGames.Email = userEmail;
                ownedGames.GameID = GameIDs[i];

                db.OwnGames.Add(ownedGames);
                db.SaveChanges();
            }
            return RedirectToAction("EmptyCart", new { userEmail = userEmail });
        }