public ActionResult UpdateItemCat(UpdateItemCategoryModel model,int id = 0) { if (ModelState.IsValid) { var r = Commodity.UpdateItemCat(id, model.Title, model.Sort, Request.Form["Displays"].TryTo(0) == 1); if (r) { TempData["success"] = "已成功修改“" + model.Title + "” 类目"; return RedirectToAction("GlobalCatalog"); } } TempData["error"] = "商品类目修改失败,请刷新后重试"; return View(model); }
public ActionResult EditCategory(UpdateItemCategoryModel model, int id) { if (ModelState.IsValid) { var r = CommodityCategory.Update(id, model.Title, Request.Form["IsDisplay"].TryTo(0) == 1, model.Image, model.Sort); if (r.Key) { TempData["success"] = "更新商品分类成功"; return RedirectToAction("Category"); } } return View(model); }
/// <summary> /// 修改类目 /// </summary> /// <returns></returns> public ActionResult UpdateItemCat(int id = 0) { if (id == 0) return Content("未输入ID或有参数未输入"); var r = Commodity.GetItemCat(id); if (r == null) return Content("没有该类目"); UpdateItemCategoryModel model = new UpdateItemCategoryModel() { Title = r.Name, Sort=(int)r.Sort, Display=r.Display, }; return View(model); }