Ejemplo n.º 1
0
        public virtual IActionResult Notification()
        {
            var searchModel = new NotificationSearchModel();

            searchModel.CustomerId = _workContext.CurrentCustomer.Id;
            var model = _privateMessagesModelFactory.PrepareNotificationListModel(searchModel);

            return(View(model));
        }
        public NotificationSearchModel PrepareNotificationSearchModel(NotificationSearchModel searchModel)
        {
            if (searchModel == null)
            {
                throw new ArgumentNullException(nameof(searchModel));
            }
            //prepare page parameters
            searchModel.SetGridPageSize();

            return(searchModel);
        }
        public IList <NotificationModel> PrepareNotificationListModel(NotificationSearchModel searchModel)
        {
            if (searchModel == null)
            {
                throw new ArgumentNullException(nameof(searchModel));
            }
            //get items
            var items = _notificationService.GetNotifications(searchModel.CustomerId, null, 0, 7);
            var model = items.Select(store => store.ToModel <NotificationModel>()).ToList();

            foreach (NotificationModel nt in model.Where(c => c.StatusId != 3))
            {
                _notificationService.UpdateStatusNotificationToRead(nt.Id);
            }
            return(model);
        }