public ActionResult CreateNotification(Notification noti) { if (noti.ClassID == 0) noti.ClassID = null; noti.CreateDate = DateTime.Now; noti.UserNameID = User.Identity.Name; notificationBL.SaveNotification(noti); db.SaveChanges(); if(noti.ClassID!=null) return Redirect(Session["CurrentUrl"].ToString()); return RedirectToAction("Index","Notification"); }
/// <summary> /// Deprecated Method for adding a new object to the Notifications EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToNotifications(Notification notification) { base.AddObject("Notifications", notification); }
/// <summary> /// Create a new Notification object. /// </summary> /// <param name="id">Initial value of the ID property.</param> /// <param name="name">Initial value of the Name property.</param> /// <param name="body">Initial value of the Body property.</param> /// <param name="createDate">Initial value of the CreateDate property.</param> /// <param name="userNameID">Initial value of the UserNameID property.</param> public static Notification CreateNotification(global::System.Int32 id, global::System.String name, global::System.String body, global::System.DateTime createDate, global::System.String userNameID) { Notification notification = new Notification(); notification.ID = id; notification.Name = name; notification.Body = body; notification.CreateDate = createDate; notification.UserNameID = userNameID; return notification; }
public ActionResult CreateNotification(int ClassID=0) { Notification noti = new Notification(); noti.ClassID = ClassID; return View(noti); }