コード例 #1
0
        public ActionResult EditCategory(UpdateArticleCategoryModel model, int id)
        {
            if (ModelState.IsValid)
            {
                var r = ArchiveCategory.UpdateCategory(id, model.Title, Request.Form["IsDisplay"].TryTo(0) == 1,
                    model.Image, model.Sort, model.Description,model.ParentId);
                if (r.Key)
                {
                    TempData["success"] = "已成功修改文章分类";
                    return RedirectToAction("Category");
                }
            }

            return View(model);
        }
コード例 #2
0
 /// <summary>
 /// 编辑文章分类
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public ActionResult EditCategory(int id)
 {
     var category = ArchiveCategory.GetCategory(id);
     var model = new UpdateArticleCategoryModel
     {
         Image = category.Image,
         Title = category.Name,
         Display = category.Display,
         ParentId = (int)category.ParentId,
         Description = category.Description,
         Sort = (int)category.Sort
     };
     return View(model);
 }