public ActionResult Create(tbl_Notifications tbl_notifications) { if (tbl_notifications==null) { ModelState.AddModelError("", "Please enter notification message"); return View(tbl_notifications); } if (ModelState.IsValid) { tbl_notifications.CreatedBy = User.Identity.Name; tbl_notifications.CreatedDate = DateTime.Now; tbl_notifications.IsActive = true; db.tbl_Notifications.AddObject(tbl_notifications); //Audit db.tbl_AuditTrail.AddObject(new tbl_AuditTrail { Action = "CREATE", ActionItem = "Notification", UserName = User.Identity.Name, ActionDate = DateTime.Now }); db.SaveChanges(); return RedirectToAction("Index"); } return View(tbl_notifications); }
/// <summary> /// Deprecated Method for adding a new object to the tbl_Notifications EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddTotbl_Notifications(tbl_Notifications tbl_Notifications) { base.AddObject("tbl_Notifications", tbl_Notifications); }
/// <summary> /// Create a new tbl_Notifications object. /// </summary> /// <param name="notification_Id">Initial value of the Notification_Id property.</param> /// <param name="createdBy">Initial value of the CreatedBy property.</param> /// <param name="createdDate">Initial value of the CreatedDate property.</param> public static tbl_Notifications Createtbl_Notifications(global::System.Int32 notification_Id, global::System.String createdBy, global::System.DateTime createdDate) { tbl_Notifications tbl_Notifications = new tbl_Notifications(); tbl_Notifications.Notification_Id = notification_Id; tbl_Notifications.CreatedBy = createdBy; tbl_Notifications.CreatedDate = createdDate; return tbl_Notifications; }
public ActionResult Edit(tbl_Notifications tbl_notifications) { if (ModelState.IsValid) { db.tbl_Notifications.Attach(tbl_notifications); db.ObjectStateManager.ChangeObjectState(tbl_notifications, EntityState.Modified); //Audit db.tbl_AuditTrail.AddObject(new tbl_AuditTrail { Action = "UPDATE", ActionItem = "Notification", UserName = User.Identity.Name, ActionDate = DateTime.Now }); db.SaveChanges(); return RedirectToAction("Index"); } return View(tbl_notifications); }