public ActionResult AddNews(NewsModel model) { if (AdminNews.AdminGetNewsIdByTitle(model.Title) > 0) { ModelState.AddModelError("Title", "标题已经存在"); } if (ModelState.IsValid) { NewsInfo newsInfo = new NewsInfo() { NewsTypeId = model.NewsTypeId, IsShow = model.IsShow, IsTop = model.IsTop, IsHome = model.IsHome, DisplayOrder = model.DisplayOrder, AddTime = DateTime.Now, Title = model.Title, Url = model.Url == null ? "" : model.Url, Body = model.Body ?? "" }; AdminNews.CreateNews(newsInfo); AddMallAdminLog("添加新闻", "添加新闻,新闻为:" + model.Title); return(PromptView("新闻添加成功")); } Load(); return(View(model)); }