public ActionResult Edit(News news) { string result = "更新失败"; if (Session["UserId"] == null) { return Content("长时间未操作,请重新登录。"); } if (news == null) { result = "参数为空"; } else { if (!string.IsNullOrEmpty(news.Title) && !string.IsNullOrEmpty(news.CategoryId) && !string.IsNullOrEmpty(news.ContentStyle)) { news.ContentText = news.ContentStyle; news.UpdateTime = DateTime.Now; news.IsActive = true; if (news.Keywords == null) { news.Keywords = string.Empty; } if (news.Description == null) { news.Description = string.Empty; } if (news.Author == null) { news.Author = string.Empty; } if (news.ComeFrom == null) { news.ComeFrom = string.Empty; } if (news.Cover == null) { news.Cover = string.Empty; } if (news.PictureGroup == null) { news.PictureGroup = string.Empty; } NewsService newsService = new NewsService(); result = newsService.EditNews(news); } else { result = "必填项 [标题、分类、内容] 不能为空"; } } return Content(result); }