public ActionResult AddItemCats(AddItemCategoryModel model, int id = 0) { if (ModelState.IsValid) { var r = Commodity.AddItemCats(id,model.Title,model.Sort,Request.Form["Display"].TryTo(0) == 1); if (r > 0) { TempData["success"] = "已成功添加“" + model.Title + "” 类目"; return RedirectToAction("GlobalCatalog"); } } TempData["error"] = "新增商品类目失败,请刷新后重试"; return View(model); }
public ActionResult AddCategory(AddItemCategoryModel model, int id = 0) { if (ModelState.IsValid) { var r = CommodityCategory.Add(model.Title, Request.Form["Display"].TryTo(0) == 1, id, model.Sort); if (r.Key > 0) { TempData["success"] = "已成功添加“" + model.Title + "” 分类"; return RedirectToAction("Category"); } } TempData["error"] = "新增商品分类失败,请刷新后重试"; return View(model); }