コード例 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            DeckTB deckTB = db.DeckTBs.Find(id);

            db.DeckTBs.Remove(deckTB);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "DeckId,PlayerId,DeckName")] DeckTB deckTB)
 {
     if (ModelState.IsValid)
     {
         db.Entry(deckTB).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(deckTB));
 }
コード例 #3
0
        public ActionResult Create([Bind(Include = "DeckId,PlayerId,DeckName")] DeckTB deckTB)
        {
            if (ModelState.IsValid)
            {
                deckTB.PlayerId = Int32.Parse(Session["Id"].ToString());

                db.DeckTBs.Add(deckTB);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(deckTB));
        }
コード例 #4
0
        // GET: DeckTBs/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            DeckTB deckTB = db.DeckTBs.Find(id);

            if (deckTB == null)
            {
                return(HttpNotFound());
            }
            return(View(deckTB));
        }