示例#1
0
 public ActionResult Index(ProductsModel productModel)
 {
     sessionUserIdCookie = Request.Cookies["UserId"];
     if (Request.IsAjaxRequest() && sessionUserIdCookie != null)
     {
         try
         {
             if (productModel.ProductId > 0)
             {
                 _productLogic.Update(productModel);
                 return(Json("Producto modificado correctamente"));
             }
             else
             {
                 _productLogic.Add(productModel);
                 return(Json("Producto creado correctamente"));
             }
         }
         catch (PersonalizedException personalizedException)
         {
             return(Json(personalizedException.Message));
         }
     }
     else
     {
         return(RedirectToAction("AccessDenied", "Users"));
     }
 }
示例#2
0
 public ActionResult AddProducts(Products pro)
 {
     if (ProductsBLL.Add(pro) > 0)
     {
         return(Content("add_yes"));
     }
     else
     {
         return(Content("add_no"));
     }
 }
示例#3
0
    private void Add(Products model)
    {
        int rows = bll.Add(model);

        if (rows > 0)
        {
            SaveExtData(rows, 1);
            Msg.ShowAndRedirect("添加信息成功!", "Default.aspx?codeNo=" + codeNo);
        }
        else
        {
            Msg.Show("添加信息失败!");
        }
    }