Пример #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Sub_Products sub_Products = db.Sub_Products.Find(id);

            db.Sub_Products.Remove(sub_Products);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #2
0
 public ActionResult Edit([Bind(Include = "Sub_Product_ID,ProductID,Sub_Product_Name,Sub_Product_Duration,Sub_Product_Details")] Sub_Products sub_Products)
 {
     if (ModelState.IsValid)
     {
         db.Entry(sub_Products).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ProductID = new SelectList(db.Products, "Product_ID", "Product_Name", sub_Products.ProductID);
     return(View(sub_Products));
 }
Пример #3
0
        public ActionResult Create([Bind(Include = "Sub_Product_ID,ProductID,Sub_Product_Name,Sub_Product_Duration,Sub_Product_Details")] Sub_Products sub_Products)
        {
            if (ModelState.IsValid)
            {
                db.Sub_Products.Add(sub_Products);
                db.SaveChanges();
                return(RedirectToAction("Create", "Sub_Products"));
            }

            ViewBag.ProductID = new SelectList(db.Products, "Product_ID", "Product_Name", sub_Products.ProductID);
            return(View(sub_Products));
        }
Пример #4
0
        // GET: Sub_Products/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Sub_Products sub_Products = db.Sub_Products.Find(id);

            if (sub_Products == null)
            {
                return(HttpNotFound());
            }
            return(View(sub_Products));
        }
Пример #5
0
        // GET: Sub_Products/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Sub_Products sub_Products = db.Sub_Products.Find(id);

            if (sub_Products == null)
            {
                return(HttpNotFound());
            }
            ViewBag.ProductID = new SelectList(db.Products, "Product_ID", "Product_Name", sub_Products.ProductID);
            return(View(sub_Products));
        }