Example #1
0
        public ActionResult Create([Bind(Include = "cat_id,cat_name")] category_table category_table)
        {
            if (ModelState.IsValid)
            {
                db.category_tables.Add(category_table);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(category_table));
        }
Example #2
0
        public ActionResult Create([Bind(Include = "product_id,product_name,product_price,product_quantity,product_details,cat_id")] product_table product_table)
        {
            if (ModelState.IsValid)
            {
                db.product_tables.Add(product_table);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.cat_id = new SelectList(db.category_tables, "cat_id", "cat_name", product_table.cat_id);
            return(View(product_table));
        }
Example #3
0
        public ActionResult Create([Bind(Include = "user_id,user_name,user_password,user_type")] user_table user_table)
        {
            if (ModelState.IsValid)
            {
                user_table.user_password = this.Hash(user_table.user_password);
                db.user_tables.Add(user_table);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(user_table));
        }