public JsonResult GetNotificationWidget() { NotificationComponent NC = new NotificationComponent(); var list = NC.GetNotifications(User.Identity.Name); return(new JsonResult { Data = list, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
public JsonResult GetNotificationContacts() { var notificationRegisterTime = Session["LastUpdated"] != null?Convert.ToDateTime(Session["LastUpdated"]) : DateTime.Now; NotificationComponent NC = new NotificationComponent(); var list = NC.GetNotifications(notificationRegisterTime); Session["LastUpdate"] = DateTime.Now; return(new JsonResult { Data = list, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
public JsonResult GetNotification() { var notificationRegisterTime = Session["LastUpdated"] != null?Convert.ToDateTime(Session["LastUpdated"]) : DateTime.Now; NotificationComponent aNotificationComponent = new NotificationComponent(); var list = aNotificationComponent.GetNotifications(notificationRegisterTime); //update session here for get only new added contacts (notification) Session["LastUpdate"] = DateTime.Now; return(new JsonResult { Data = list, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
public JsonResult GetNotifications() { var userID = (int)Session["userID"]; try { NotificationComponent NC = new NotificationComponent(); var notifications = NC.GetNotifications(userID); var output = notifications.Select(s => new { Message = s.Message + " " + s.DateNotification.ToShortDateString() + " " + s.DateNotification.ToShortTimeString(), s.URL, s.ID, s.Avatar, s.ID_Project }); return(new JsonResult { Data = output, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); } catch (Exception ex) { Console.WriteLine(ex.Message); } return(null); }
public JsonResult GetNotificationContacts(string WhenCalled) { string user = User.Identity.GetUserName(); string name = dbContext.Users.Where(x => x.Email == user).FirstOrDefault().Name; var notificationRegisterTime = Session["LastUpdated"] != null?Convert.ToDateTime(Session["LastUpdated"]) : DateTime.Now; NotificationComponent NC = new NotificationComponent(); var list = NC.GetNotifications(Convert.ToDateTime(Session["LastUpdated"]), name); //update session here for get only new added contacts (notification) if (WhenCalled == "update") { Session["LastUpdated"] = DateTime.Now; } return(new JsonResult { Data = list, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }