public ActionResult Create(ProductCategory productCategory, string tempstatus)
 {
     if (ModelState.IsValid)
     {
         ProductCategoryDAO productCategoryDAO = new ProductCategoryDAO();
         productCategory.CreateBy   = BaseController.NguoiDungHienTai.UserAccount;
         productCategory.CreateDate = DateTime.Now;
         if (tempstatus == "Kích Hoạt")
         {
             productCategory.Status = true;
         }
         else
         {
             productCategory.Status = false;
         }
         var check = productCategoryDAO.Create(productCategory);
         if (check > 0)
         {
             TempData["msg"] = MessageBox.Show("Create successfully");
             return(RedirectToAction("Create", "ProductCategory"));
         }
         else
         {
             ModelState.AddModelError("", "Create fail");
         }
     }
     SetCategoryParent();
     return(View());
 }
 public ActionResult Create(ProductCategory productCategory)
 {
     if (ModelState.IsValid)
     {
         var dao = new ProductCategoryDAO();
         //var session = (UserLogin)Session[CommonConstants.USER_SESSION];
         //product.ModifiedBy = session.UserName;
         productCategory.CreatedBy   = "admin";
         productCategory.CreatedDate = DateTime.Now;
         long id = dao.Create(productCategory);
         if (id > 0)
         {
             SetAlert("Thêm danh mục sản phẩm thành công", "success");
             return(RedirectToAction("Index", "ProductCategory"));
         }
         else
         {
             SetAlert("Thêm thất bại", "error");
         }
     }
     return(View());
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 创建一个新实例
 /// </summary>
 /// <param name="pEntity">实体实例</param>
 public void Create(ProductCategoryEntity pEntity)
 {
     _currentDAO.Create(pEntity);
 }