예제 #1
0
        public List <ReadNotificationDTO> GetAllNotifications()
        {
            using (UnitOfWork uw = new UnitOfWork())
            {
                List <Notification> notificationsFromDB = uw.NotificationRepository.GetAll();

                return(ReadNotificationDTO.FromList(notificationsFromDB));
            }
        }
예제 #2
0
        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);
        }