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

            db.ProductTypeTables.Remove(productTypeTable);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #2
0
 public ActionResult Edit([Bind(Include = "ProductTypeID,ProductType")] ProductTypeTable productTypeTable)
 {
     if (ModelState.IsValid)
     {
         db.Entry(productTypeTable).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(productTypeTable));
 }
Пример #3
0
        public ActionResult Create([Bind(Include = "ProductTypeID,ProductType")] ProductTypeTable productTypeTable)
        {
            if (ModelState.IsValid)
            {
                db.ProductTypeTables.Add(productTypeTable);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(productTypeTable));
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["user"] == null || !UserController.isAdmin(Int32.Parse(Session["user"].ToString())))
            {
                Response.Redirect("/View/Home.aspx");
                return;
            }

            ProductTypeTable.DataSource = ProductTypeController.getAllProductTypes();
            ProductTypeTable.DataBind();
        }
        public IQueryable <ProductCategory> GetProductConstructionList()
        {
            var Con = (from p in db.ProductCategory
                       join pt in db.ProductTypes on p.ProductTypeId equals pt.ProductTypeId into ProductTypeTable
                       from ProductTypetab in ProductTypeTable.DefaultIfEmpty()
                       where ProductTypetab.ProductTypeName == ProductTypeConstants.Rug
                       orderby p.ProductCategoryName
                       select p
                       );

            return(Con);
        }
Пример #6
0
        // GET: ProductType/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ProductTypeTable productTypeTable = db.ProductTypeTables.Find(id);

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