示例#1
0
        public ActionResult DeleteConfirmed(string id)
        {
            Tbl_Categories tbl_Categories = db.Tbl_Categories.Find(id);

            db.Tbl_Categories.Remove(tbl_Categories);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#2
0
 public ActionResult Edit([Bind(Include = "ID,CategoryName")] Tbl_Categories tbl_Categories)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tbl_Categories).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tbl_Categories));
 }
示例#3
0
        public ActionResult Create([Bind(Include = "ID,CategoryName")] Tbl_Categories tbl_Categories)
        {
            if (ModelState.IsValid)
            {
                db.Tbl_Categories.Add(tbl_Categories);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(tbl_Categories));
        }
示例#4
0
        // GET: Tbl_Categories/Edit/5
        public ActionResult Edit(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Tbl_Categories tbl_Categories = db.Tbl_Categories.Find(id);

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