コード例 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Btw btw = db.Btws.Find(id);

            db.Btws.Remove(btw);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "Id,BtwNaam,BtwValue")] Btw btw)
 {
     if (ModelState.IsValid)
     {
         db.Entry(btw).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(btw));
 }
コード例 #3
0
        public ActionResult Create([Bind(Include = "Id,BtwNaam,BtwValue")] Btw btw)
        {
            if (ModelState.IsValid)
            {
                db.Btws.Add(btw);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

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

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