public ActionResult SaveNotification(NotificationsModel mangeNotifications) { if (Convert.ToString(Session["key"]) != "admin") { return(RedirectToAction("Login", "Home")); } Admin_Api adminApi = new Admin_Api(); IEnumerable <NotificationsModel> notificationsModels = null; if (!mangeNotifications.Expiry.Equals("1/1/0001 12:00:00 AM")) { mangeNotifications.AdminID = (int)Session["UserId"]; mangeNotifications.Created_DateTime = DateTime.Now; notificationsModels = adminApi.InsertNotifications(mangeNotifications); } return(View("~/Views/Administrator/AdminManageNotifications.cshtml", notificationsModels)); }