public ActionResult Edit() { sd_news news = new sd_news(); if (!string.IsNullOrEmpty(Request["newsid"])) { news = new News().Find(int.Parse(Request["newsid"].ToString())); } ViewData["news"] = news; return View(); }
public ActionResult Delete() { if (Request["newsid"] != null) { sd_news model = new sd_news { Id = int.Parse(Request["newsid"].ToString()) }; bool result = new News().Delete(model); } return Json(false); }
public ActionResult EditNews(string models) { sd_news news = new sd_news(); List<sd_news> list = new List<sd_news>(); JsonResult result = new JsonResult(); if (models != null) { news = Newtonsoft.Json.JsonConvert.DeserializeObject<sd_news>(models); list.Add(news); result.Data = new News().Update(list); } return result; }
public ActionResult PublishNews(string models) { sd_news news = new sd_news(); JsonResult result = new JsonResult(); if (models != null) { news = JsonConvert.DeserializeObject<sd_news>(models); news.content = news.content.Replace("?", "").Replace("?", ""); var data = new News().Add(news); result.Data = true; } else { result.Data = false; } return result; }