public ActionResult EditCategory(UpdateArticleCategoryModel model, int id) { if (ModelState.IsValid) { var r = YunClient.Instance.Execute(new UpdateCategoryRequest { Id = id, Name = model.Title, Display = Request.Form["IsDisplay"].TryTo(0) == 1, Image = model.Image, NewImage = FileManage.GetFirstFile(), Sort = model.Sort, ParentId = model.ParentId, Description = model.Description }, Token); if (r.Result) { TempData["success"] = "已成功修改文章分类"; return(RedirectToAction("Category")); } } return(View(model)); }
public ActionResult AddCategory(AddArticleCategoryModel model, int id = 0) { if (ModelState.IsValid) { var r = YunClient.Instance.Execute(new AddCategoryRequest { Name = model.Title, Display = Request.Form["Display"].TryTo(0) == 1, Image = FileManage.GetFirstFile(), Description = model.Description, ParentId = id }, Token); if (r.Result > 0) { TempData["success"] = "已成功添加“" + model.Title + "” 分类"; return(RedirectToAction("Category")); } TempData["error"] = "添加失败,该分类已经存在"; } return(View(model)); }
public ActionResult EditCategory(UpdateItemCategoryModel model, int id) { if (ModelState.IsValid) { var r = YunClient.Instance.Execute(new UpdateShopItemCategoryRequest { Id = id, Title = model.Title, Display = Request.Form["IsDisplay"].TryTo(0) == 1, Image = model.Image, NewImage = FileManage.GetFirstFile(), Sort = model.Sort }, Token); if (r.Result) { TempData["success"] = "更新商品分类成功"; return(RedirectToAction("Category")); } } 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)); }