public List <ReadNotificationDTO> GetAllNotifications() { using (UnitOfWork uw = new UnitOfWork()) { List <Notification> notificationsFromDB = uw.NotificationRepository.GetAll(); return(ReadNotificationDTO.FromList(notificationsFromDB)); } }
public List <ReadNotificationDTO> GetUserNotifications(string username) { List <ReadNotificationDTO> list = null; using (UnitOfWork uw = new UnitOfWork()) { User u = uw.UserRepository.GetUserByUsername(username); if (u != null) { list = ReadNotificationDTO.FromList(u.Notifications.Reverse().ToList()); } } return(list); }