Exemplo n.º 1
0
        public ISubscriptionContentIndexViewModel LoadAllUnreadRssEntriesToReadForCurrentUserFromSubscription(
            FeedsGetRead input)
        {
            var provider      = this.subscriptionHandlerFactory.GetProvider(input.StreamType);
            var currentUserId = this.infrastructure.GetCurrentUserId();
            var viewmodel     = provider.GetSubscriptionViewModel(currentUserId, input);

            return(viewmodel);
        }
        public ISubscriptionContentIndexViewModel GetSubscriptionViewModel(
            long userId,
            FeedsGetRead input)
        {
            if (!this.entityRepository.DoesUserOwnsUserSubscription(input.FeedId, userId))
            {
                var rssSubscriptionIndexViewModel = new PersonSubscriptionIndexViewModel(
                    input.FeedId,
                    "You are not subscribed to this user",
                    DateTime.MaxValue,
                    new List <RssEntryToReadViewModel>());
                return(rssSubscriptionIndexViewModel);
            }

            List <UserSubscriptionEntryToReadDTO> loadAllUnreadEntriesFromSubscription;

            if (input.ShowReadEntries == ShowReadEntries.Show)
            {
                loadAllUnreadEntriesFromSubscription =
                    this.entityRepository.LoadAllUserEntriesFromSubscription(input.FeedId);
            }
            else
            {
                loadAllUnreadEntriesFromSubscription =
                    this.entityRepository.LoadAllUserUnreadEntriesFromSubscription(input.FeedId);
            }

            var channelInformation = this.entityRepository.LoadUserChannelInformation(input.FeedId);

            var rssEntryToReadViewModels =
                this.mapper.Map <List <UserSubscriptionEntryToReadDTO>, List <RssEntryToReadViewModel> >
                    (loadAllUnreadEntriesFromSubscription);

            rssEntryToReadViewModels.ForEach(x => x.RssEntryViewModel.SubscriptionId = input.FeedId);

            var viewModel = new PersonSubscriptionIndexViewModel(
                input.FeedId,
                channelInformation.Title,
                channelInformation.Created,
                rssEntryToReadViewModels);

            return(viewModel);
        }
        public ISubscriptionContentIndexViewModel GetSubscriptionViewModel(long userId, FeedsGetRead input)
        {
            var rssEntryToReadDtos       = this.entityRepository.LoadRss(input.FeedId, userId, input.Skip, input.Take);
            var rssEntryToReadViewModels = rssEntryToReadDtos.Select(
                x => new RssEntryToReadViewModel
            {
                RssEntryViewModel =
                    new RssEntryViewModel
                {
                    Id          = x.Id,
                    Title       = x.Title,
                    PreviewText =
                        this.htmlStripper.GetContentOnly(
                            x.PreviewText),
                    PublicationDate = x.PublicationDate,
                    Url             = x.Url,
                    SubscriptionId  = input.FeedId
                }
            }).ToList();
            var rssChannelInformationDto = this.entityRepository.LoadChannelChannelInformation(input.FeedId);
            var viewModel = new RssSubscriptionIndexViewModel(
                input.FeedId,
                rssChannelInformationDto.Title,
                rssChannelInformationDto.Created,
                rssEntryToReadViewModels);

            return(viewModel);
        }
Exemplo n.º 4
0
        public ISubscriptionContentIndexViewModel GetSubscriptionViewModel(long userId, FeedsGetRead input)
        {
            var loadAllRssEntriesForUserAndChannel = this.LoadCreationEvents(userId);

            var subscriptionIndexViewModel = new ChannelCreationSubscriptionIndexViewModel(0,
                                                                                           "Channel creation events",
                                                                                           DateTime.MinValue,
                                                                                           loadAllRssEntriesForUserAndChannel);

            return(subscriptionIndexViewModel);
        }
        public ISubscriptionContentIndexViewModel GetSubscriptionViewModel(long userId, FeedsGetRead input)
        {
            var loadAllRssEntriesForUserAndChannel = this.LoadExceptionEvents(userId, input.Skip, input.Take);
            var subscriptionIndexViewModel         = new ExceptionSubscriptionIndexViewModel(
                0,
                "Exceptions",
                DateTime.MinValue,
                loadAllRssEntriesForUserAndChannel);
            var rssSubscriptionIndexViewModel = subscriptionIndexViewModel;

            return(rssSubscriptionIndexViewModel);
        }
Exemplo n.º 6
0
 public virtual JsonNetResult ReadAjax(FeedsGetRead input)
 {
     var entries = this.service.LoadAllUnreadRssEntriesToReadForCurrentUserFromSubscription(input);
     var result = new JsonNetResult(entries);
     return result;
 }
        public ISubscriptionContentIndexViewModel GetSubscriptionViewModel(long userId, FeedsGetRead input)
        {
            var loadAllRssEntriesForUserAndChannel = this.LoadUpdateEvents(userId, input.Skip, input.Take);

            var subscriptionIndexViewModel = new ChannelUpdateSubscriptionIndexViewModel(
                0,
                "Channel update events",
                DateTime.MinValue,
                loadAllRssEntriesForUserAndChannel);

            return(subscriptionIndexViewModel);
        }