public async Task <ActionResult <List <NotificationWithStatus> > > GetNotifications() { var notifications = await _context.NotificationUsers .Where(o => o.UserId == GetUserId()) //.Include(o => o.FK_Table).ThenInclude(p => p.Toppings).ThenInclude(t => t.Topping) .OrderByDescending(o => o.CreatedTime) .ToListAsync(); return(notifications.Select(o => NotificationWithStatus.FromExecute(o)).ToList()); }
public async Task <ActionResult <NotificationWithStatus> > GetNotificationWithStatus(int notificationId) { var notification = await _context.NotificationUsers .Where(o => o.NotificationId == notificationId) .Where(o => o.UserId == GetUserId()) //.Include(o => o.DeliveryLocation) .SingleOrDefaultAsync(); if (notification == null) { return(NotFound()); } return(NotificationWithStatus.FromExecute(notification)); }