public ActionResult Create(Product product)
 {
     if (ModelState.IsValid)
     {
         var rewriteurl = new RewriteURL();
         var merchant   = (Account)Session[Common.CommonConstants.USER_INFO_SESSION];
         var dao        = new ProductDAO();
         product.MetaTitle        = rewriteurl.ConvertToUnSign(product.Name);
         product.CreateBy         = merchant.ID;
         product.CreateDate       = DateTime.Now;
         product.MetaDescriptions = rewriteurl.ConvertToUnSign(product.Descriptions);
         product.Status           = false;
         product.IsHidden         = 0;
         long id = dao.Insert(product);
         if (id > 0)
         {
             //setAlert("Thêm tài khoản thành công", "success");
             return(RedirectToAction("Index", "ShopManager"));
         }
         else
         {
             ModelState.AddModelError("", "Thêm sản phẩm thất bại");
         }
     }
     return(View("Index"));
 }
Exemplo n.º 2
0
        public string RewriteUrl(string text)
        {
            var rewrite = new RewriteURL();
            var url     = rewrite.ConvertToUnSign(text);

            return(url);
        }