public ActionResult Newscontent(string theid) { HappyEntities db = new HappyEntities(); decimal newsid1 = decimal.Parse(theid); t_f_news dd = db.t_f_news.Where(s => s.newsid == newsid1).First(); ViewData["newsid"] = dd.newsid; //编号ID ViewData["time"] = dd.time; //时间 ViewData["title1"] = dd.title; //标题 ViewData["content"] = dd.content; //内容 return(View()); }
public ActionResult NewsContent(string id) { ClusDBEntities db = new ClusDBEntities(); decimal pid1 = decimal.Parse(id); t_f_news dd = db.t_f_news.Where(s => s.ID == pid1).First(); ViewData["did"] = dd.ID; //编号 ViewData["endtime"] = dd.EditTime; //时间 ViewData["content"] = dd.Content; //内容 ViewData["TTitle"] = dd.Title; //标题 return(View()); }
public ActionResult EditNews(string id) { HappyEntities db = new HappyEntities(); List <SelectListItem> recuit = new List <SelectListItem>(); decimal newsid = decimal.Parse(id); t_f_news dd = db.t_f_news.Where(s => s.newsid == newsid).First(); ViewData["newsid"] = dd.newsid; //编号ID ViewData["time"] = dd.time; //时间 ViewData["title1"] = dd.title; //标题 ViewData["content"] = dd.content; //内容 return(View()); }
public ActionResult Index(FormCollection fc) { //string content = Request.Form["editor"]; //return View(); ////var title = SaveTitle(json); string data = Request.Form["title"]; string content = fc["editor"]; System.DateTime starttime = new System.DateTime(); starttime = DateTime.Now; if (data == "") { ViewData["back_news"] = "标题为空,请重新输入"; return(View()); } else if (content == "") { ViewData["back_news"] = "内容为空,请重新输入"; return(View()); } else { try { using (var db = new HappyEntities()) { var news = new t_f_news() { title = data, content = content, time = starttime, isDel = false }; db.t_f_news.Add(news); db.SaveChanges(); ViewData["back_news"] = "保存成功!"; return(View()); } } catch (Exception ex) { ViewData["back_news"] = "保存失败"; return(View()); } } }