示例#1
0
        public ActionResult AddProductType()
        {
            string           proTypeName = Request.Params["protype_name"].Trim();
            ProductTypeModel ptModel     = new ProductTypeModel();

            ptModel.PRO_TYPE_NAME = proTypeName;

            Database       db    = new Database();
            ProductTypeDAO ptDAO = new ProductTypeDAO(db);
            int            id    = ptDAO.Add(ptModel);

            db.Close();

            System.Diagnostics.Debug.WriteLine("LAST ID PRODUCT_TYPE : " + id);
            if (id > 0)
            {
                return(RedirectToAction("Alert", "Product", new { link = "~/Product/ManageProduct", massage = "เพิ่มข้อมูลเรียบร้อย" }));
            }
            else
            {
                return(RedirectToAction("ManageProduct", "Product"));
            }
        }