// // GET: /Detail/ public ActionResult News(int? id) { News dal = new News(); Ba_News model = dal.GetSingleNewsById(id.HasValue ? (int)id : 1); return View(model); }
public string Delete(int id) { string result = "0"; News dal = new News(); var model = dal.GetSingleNewsById(id); if (model != null) { model.Ns_State = false; dal.Update(model); result = "1"; } return result; }
// // GET: /SuperAdmin/NewsOperate/ public ActionResult Index(int? id) { ViewBag.jsInit = Public.SuperAdminCommon.JSInit("NewsManage", "NewsOperate"); var model = new Ba_News(); if (id != null) { News dal = new News(); model = dal.GetSingleNewsById((int)id); } if (model == null) model = new Ba_News(); ViewBag.model = model; if (model.Ns_ID.Equals(0)) ViewBag.Title = "新增最新消息"; else ViewBag.Title = "更新最新消息"; return View(); }
public string Submit(NewsOperate_Form form) { string result = string.Empty; News dal = new News(); var model = dal.GetSingleNewsById(form.news_id); if (model == null) model = new Ba_News(); model.Ns_Title = form.news_title; model.Ns_SubTitle = form.news_subtitle; model.Ns_Content = form.news_description; model.Ns_BuildTime = DateTime.Now; model.Ns_State = true; try { dal.SaveOrUpdate(model); result = "1"; } catch (System.Exception ex) { result = ex.ToString(); } return result; }