public ActionResult DeleteConfirmed(int id)
        {
            SubCategoryID subCategoryID = db.SubCategoryIDs.Find(id);

            db.SubCategoryIDs.Remove(subCategoryID);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "SubCategoryID1,name,categoryid")] SubCategoryID subCategoryID)
 {
     if (ModelState.IsValid)
     {
         db.Entry(subCategoryID).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.categoryid = new SelectList(db.categories, "categoryId", "name", subCategoryID.categoryid);
     return(View(subCategoryID));
 }
        public ActionResult Create([Bind(Include = "SubCategoryID1,name,categoryid")] SubCategoryID subCategoryID)
        {
            if (ModelState.IsValid)
            {
                db.SubCategoryIDs.Add(subCategoryID);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.categoryid = new SelectList(db.categories, "categoryId", "name", subCategoryID.categoryid);
            return(View(subCategoryID));
        }
        // GET: SubCategorys/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SubCategoryID subCategoryID = db.SubCategoryIDs.Find(id);

            if (subCategoryID == null)
            {
                return(HttpNotFound());
            }
            return(View(subCategoryID));
        }
        // GET: SubCategorys/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SubCategoryID subCategoryID = db.SubCategoryIDs.Find(id);

            if (subCategoryID == null)
            {
                return(HttpNotFound());
            }
            ViewBag.categoryid = new SelectList(db.categories, "categoryId", "name", subCategoryID.categoryid);
            return(View(subCategoryID));
        }