public ActionResult Add(string Description, int? Priority, bool IsShow) { try { Notification notification = new Notification(); if (!Priority.HasValue) { notification.Priority = 0; } else { notification.Priority = (int)Priority; } notification.Description = Description; notification.IsShow = IsShow; notification.CreatedTime = DateTime.Now; bllSession.INotificationBLL.Insert(notification); return Redirect("/Admin/Notification/Index"); } catch { log.Error(new LogContent("增加通告失败", LogType.异常.ToString(), HttpHelper.GetIPAddress())); ModelState.AddModelError("", "增加通告失败"); } return View(); }
public ActionResult Edit(int id) { Notification notification = new Notification(); notification = bllSession.INotificationBLL.GetEntity(id); return View(notification); }
public ActionResult Edit(Notification model) { try { Notification notification = new Notification(); notification = bllSession.INotificationBLL.GetEntity(model.Id); if (notification != null) { notification.Description = model.Description; notification.Priority = model.Priority; notification.IsShow = model.IsShow; bllSession.INotificationBLL.Update(notification); return Redirect("/Admin/Notification/Index"); } } catch { log.Error(new LogContent("修改通告失败", LogType.异常.ToString(), HttpHelper.GetIPAddress())); ModelState.AddModelError("", "修改通告失败"); } return View(); }