/// <summary> /// 添加公告的功能实现 /// </summary> /// <returns></returns> public ActionResult DoAddMsg(N_News model) { model.UID = base.LoginUser.ID; model.isDel = false; model.SubDateTime = DateTime.Now; try { //8月12日修改:此处不仅需要在N_News中添加一个消息对象,还需要添加该消息与全部用户之前的关系 //1 查询所有用户 var users= userBLL.GetListBy(u => u.DelFlag == false).Select(u => u.ID); //2 遍历用户数组,并添加要创建的news与user的关系 foreach (var item in users) { R_UserInfo_News r_user_news = new R_UserInfo_News() { NID = model.SNID, UID = item }; model.R_UserInfo_News.Add(r_user_news); } newsBLL.Create(model); return Content("ok"); } catch { return Content("error"); } }
/// <summary> /// 编辑公告的功能实现 /// </summary> /// <returns></returns> public ActionResult DoEditMsg(N_News model) { model.isDel = false; model.SubDateTime = DateTime.Now; model.UID = base.LoginUser.ID; try { newsBLL.Update(model); return Content("ok"); } catch { return Content("error"); } }
/// <summary> /// 存入消息 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool CreateNews(N_News model) { return false; }