/// <summary> /// 编辑公告 /// </summary> /// <param name="wn"></param> /// <returns></returns> public bool EditNotice(Work_Notice wn, Admin_KSCustomer aks,int id) { DataAccess.Work_Notice wnote = _db.Work_Notice.Where(s => s.ID == id).FirstOrDefault(); wnote.NTitle = wn.NTitle; wnote.NContent = wn.NContent; wnote.NCustomerID = aks.ID; wnote.NCustomerName = aks.CusName; wnote.Nlevel = wnote.Nlevel; int result = _db.SaveChanges(); if (result == 1) { return true; } else { return false; } }
/// <summary> /// 新增公告 /// </summary> /// <param name="wn"></param> /// <returns></returns> public bool AddNotice(Work_Notice wn, Admin_KSCustomer aks) { DataAccess.Work_Notice wnote = new DataAccess.Work_Notice(); wnote.NTitle = wn.NTitle; wnote.NContent = wn.NContent; wnote.AddTime = DateTime.Now; wnote.NCustomerID = aks.ID; wnote.NCustomerName = aks.CusName; wnote.Nlevel = wnote.Nlevel; _db.Work_Notice.AddObject(wnote); int result = _db.SaveChanges(); if (result == 1) { return true; } else { return false; } }
/// <summary> /// 添加公告 /// </summary> /// <returns></returns> public ActionResult AddNotice(FormCollection form) { if (form.Count != 0) { Work_Notice wn = new Work_Notice(); wn.NTitle = form["WTitle"]; wn.NContent = form["WConetent"]; wn.Nlevel = 1;//form["Nlevel"]; Admin_KSCustomer aks = (Admin_KSCustomer)Session["member"]; if (new Work_NoticeLogic().AddNotice(wn, aks)) { ViewBag.msg = "添加成功"; } else { ViewBag.msg = "添加失败"; } } return View(); }
public ActionResult EditNotice(FormCollection form) { int id = Convert.ToInt32(form["ntid"]); if (form.Count != 0) { Work_Notice wn = new Work_Notice(); wn.NTitle = form["WTitle"]; wn.NContent = form["WConetent"]; wn.Nlevel = 1;//form["Nlevel"]; Admin_KSCustomer aks = (Admin_KSCustomer)Session["member"]; if (new Work_NoticeLogic().EditNotice(wn, aks, id)) { ViewBag.msg = "修改成功"; } else { ViewBag.msg = "修改失败"; } } return EditNotice(id); }
/// <summary> /// 编辑公告 /// </summary> /// <param name="id"></param> /// <returns></returns> public ActionResult EditNotice(int id) { Work_Notice wn = new Work_NoticeLogic().GetNoticeModel(id); if (wn == null) { wn = new Work_Notice(); } return View(wn); }