public ActionResult AddItemCats(AddItemCategoryModel model, int id = 0) { if (ModelState.IsValid) { var r = YunClient.Instance.Execute(new AddItemCatsRequest { ParentId = id, Name = model.Title, Sort = model.Sort, Display = Request.Form["Display"].TryTo(0) == 1, }, Token).Result; if (r > 0) { TempData["success"] = "已成功添加“" + model.Title + "” 类目"; return RedirectToAction("ItemCat"); } } TempData["error"] = "新增商品类目失败,请刷新后重试"; return View(model); }
public ActionResult AddShopCat(AddItemCategoryModel model, int id = 0) { if (ModelState.IsValid) { var r = YunClient.Instance.Execute(new AddShopCategoryRequest { Name = model.Title, ParentId = id, Sort = model.Sort }, Token); if (r.Result > 0) { TempData["success"] = "已成功添加“" + model.Title + "” 分类"; return RedirectToAction("ShopCatList"); } } TempData["error"] = "新增商户分类失败,请刷新后重试"; return View(model); }
public ActionResult AddCategory(AddItemCategoryModel model, int id = 0) { if (ModelState.IsValid) { var r = YunClient.Instance.Execute(new AddShopItemCategoryRequest { Title = model.Title, Display = Request.Form["Display"].TryTo(0) == 1, Image = FileManage.GetFirstFile(), ParentId = id, Sort = model.Sort }, Token); if (r.Result > 0) { TempData["success"] = "已成功添加“" + model.Title + "” 分类"; return RedirectToAction("Category"); } } TempData["error"] = "新增商品分类失败,请刷新后重试"; return View(model); }