public ActionResult NotifySave() { string Title = GetString("Title"); if (Title != "") { News news = new News(); news.Title = Title; news.Status = (int)NewsStatus.Approved; news.OrgID = GetOrg().OrgID; //news.PubAuthor = GetString("PubAuthor"); news.Content = GetString("NewsContent"); news.IsNotify = true; news.IsApproved = true; news.IsImportant = false; news.PubDate = DateTime.Now; news.PubSource = GetString("PubSource"); news.IsImportant = false; news.IsApproved = true; CQGJ.AddToNews(news); CQGJ.SaveChanges(); } return RedirectToAction("NotifyList/1"); }
public ActionResult ArticleSave() { string Title = GetString("Title"); string Content = GetString("NewsContent"); string PubSource = GetString("PubSource"); if (Title != "" && Content != "" && GetString("Column") != "") { News news = new News(); news.Title = Title; news.PubAuthor = GetAdmin().Username; news.Content = Content; news.PubDate = DateTime.Now; news.PubSource = PubSource; news.OrgID = GetOrg().OrgID; news.ViewNum = 0; news.Status = (int?)NewsStatus.Publised; news.IsNotify = false; news.IsApproved = false; news.IsImportant = false; //if (IsImportance == 1) //{ // news.IsImportant = true; //} //else //{ // news.IsImportant = false; //} news.IsApproved = false; CQGJ.AddToNews(news); // string[] arraycolumnid = GetString("Column").Split(','); foreach (var s in arraycolumnid) { int columnid = int.Parse(s); Column column = (from c in CQGJ.Column where c.ColumnID == columnid select c).First(); NewsColumn newsColumn = new NewsColumn(); newsColumn.Column = column; newsColumn.News = news; CQGJ.AddToNewsColumn(newsColumn); } CQGJ.SaveChanges(); //更新首页Flash图片 SetFlashPic(); //跳转回List页面 //跳转页面都需要问题 return RedirectToAction("ArticleAllList/1"); } else { //TempData["Message"] = "字段不能留空!"; return RedirectToAction("ArticleAdd"); } }