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")); } }
public ActionResult AddProducts(Products pro) { if (ProductsBLL.Add(pro) > 0) { return(Content("add_yes")); } else { return(Content("add_no")); } }
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("添加信息失败!"); } }