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

            db.tblItemCategories.Remove(tblItemCategory);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #2
0
 public ActionResult Edit2([Bind(Include = "ItemCategoryID,ItemID,CategoryID,Status,StatusBeschrijving")] tblItemCategory tblItemCategory)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tblItemCategory).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CategoryID = new SelectList(db.tblCategories, "CategoryID", "CategoryName", tblItemCategory.CategoryID);
     ViewBag.ItemID     = new SelectList(db.tblItems, "ItemID", "ItemName", tblItemCategory.ItemID);
     return(View(tblItemCategory));
 }
コード例 #3
0
        public ActionResult Create([Bind(Include = "ItemCategoryID,ItemID,CategoryID")] tblItemCategory tblItemCategory)
        {
            tblItemCategory.Status = "Te Accorderen creatie";
            if (ModelState.IsValid)
            {
                db.tblItemCategories.Add(tblItemCategory);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.CategoryID = new SelectList(db.tblCategories, "CategoryID", "CategoryName", tblItemCategory.CategoryID);
            ViewBag.ItemID     = new SelectList(db.tblItems, "ItemID", "ItemName", tblItemCategory.ItemID);
            return(View(tblItemCategory));
        }
コード例 #4
0
        // GET: tblItemCategories/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tblItemCategory tblItemCategory = db.tblItemCategories.Find(id);

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

            if (tblItemCategory == null)
            {
                return(HttpNotFound());
            }
            ViewBag.CategoryID = new SelectList(db.tblCategories, "CategoryID", "CategoryName", tblItemCategory.CategoryID);
            ViewBag.ItemID     = new SelectList(db.tblItems, "ItemID", "ItemName", tblItemCategory.ItemID);
            return(View(tblItemCategory));
        }