public async Task <IActionResult> Inbox(int?pageNumber, string query = null) { var user_id = _userManager.GetUserId(HttpContext.User); int pageSize = 25; var notifications = NotificationUtil.Get().Where(e => e.user_id == user_id); if (!string.IsNullOrEmpty(query)) { notifications = notifications.Where(e => e.notification.Contains(query)); } return(View(await PaginatedList <mp_notification> .CreateAsync(notifications.OrderByDescending(e => e.created_at).AsNoTracking(), pageNumber ?? 1, pageSize))); }
public async Task <IActionResult> Get() { var email = _userManager.GetUserId(HttpContext.User); var user = await _userManager.FindByEmailAsync(email); var notifications = NotificationUtil.Get().Where(e => e.user_id == user.Id); //if (!string.IsNullOrEmpty(query)) //{ // //} if (!notifications.Any()) { return(Ok(new List <mp_notification>())); } return(Ok(notifications)); }
public IActionResult LoadMessagePartial(long message_id) { NotificationUtil.MarkAsRead(message_id); return(PartialView(NotificationUtil.Get().FirstOrDefault(e => e.id == message_id))); }