public ActionResult AddCategory(NewsCategory category) { if (Session["UserId"] == null) { return Redirect("/admin/login"); } if (category != null) { if (!string.IsNullOrEmpty(category.Id) && !string.IsNullOrEmpty(category.Name) && category.Sort > 0) { category.IsActive = true; NewsService newsService = new NewsService(); newsService.AddNewsCategory(category); Cache.UpdateNewsCategories();//更新缓存 } } return Redirect(Request.UrlReferrer.AbsoluteUri); }