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); }
private RssSubscriptionIndexViewModel GetPersonSubscriptionIndexViewModel(long subscriptionId, ShowReadEntries showReadEntries) { var currentUserId = this.sessionProvider.GetCurrentUserId(); if (!this.usersSubscriptionRepository.DoesUserOwnsSubscription(subscriptionId, currentUserId)) { var ci = new ChannelInformationViewModel { Title = "You are not subscribed to this user", Created = DateTime.MaxValue }; var rssSubscriptionIndexViewModel = new RssSubscriptionIndexViewModel(subscriptionId, ci, new List <RssEntryToReadViewModel>(), StreamType.Person); return(rssSubscriptionIndexViewModel); } List <UserSubscriptionEntryToRead> loadAllUnreadEntriesFromSubscription; if (showReadEntries != ShowReadEntries.Show) { loadAllUnreadEntriesFromSubscription = this.usersSubscriptionRepository .LoadAllUnreadEntriesFromSubscription(subscriptionId); } else { loadAllUnreadEntriesFromSubscription = this.usersSubscriptionRepository .LoadAllEntriesFromSubscription(subscriptionId); } var channelInformation = this.usersSubscriptionRepository .LoadChannelInformation(subscriptionId); var channelInformationViewModel = new ChannelInformationViewModel { Title = channelInformation.Title, Created = channelInformation.Created }; var rssEntryToReadViewModels = this.mapper.Map <List <RssEntryToReadViewModel> >(loadAllUnreadEntriesFromSubscription); var viewModel = new RssSubscriptionIndexViewModel( subscriptionId, channelInformationViewModel, rssEntryToReadViewModels, StreamType.Person); return(viewModel); }
private RssSubscriptionIndexViewModel GetPersonSubscriptionIndexViewModel(long subscriptionId, ShowReadEntries showReadEntries) { var currentUserId = this.authentication.GetCurrentUserId(); if (!this.usersSubscriptionRepository.DoesUserOwnsSubscription(subscriptionId, currentUserId)) { var ci = new ChannelInformationViewModel { Title = "You are not subscribed to this user", Created = DateTime.MaxValue }; var rssSubscriptionIndexViewModel = new RssSubscriptionIndexViewModel(subscriptionId, ci, new List<RssEntryToReadViewModel>(), StreamType.Person); return rssSubscriptionIndexViewModel; } List<UserSubscriptionEntryToReadDTO> loadAllUnreadEntriesFromSubscription; if (showReadEntries != ShowReadEntries.Show) { loadAllUnreadEntriesFromSubscription = this.usersSubscriptionRepository .LoadAllUnreadEntriesFromSubscription(subscriptionId); } else { loadAllUnreadEntriesFromSubscription = this.usersSubscriptionRepository .LoadAllEntriesFromSubscription(subscriptionId); } var channelInformation = this.usersSubscriptionRepository .LoadChannelInformation(subscriptionId); var channelInformationViewModel = new ChannelInformationViewModel { Title = channelInformation.Title, Created = channelInformation.Created }; var rssEntryToReadViewModels = this.mapper.Map<List<RssEntryToReadViewModel>>(loadAllUnreadEntriesFromSubscription); var viewModel = new RssSubscriptionIndexViewModel( subscriptionId, channelInformationViewModel, rssEntryToReadViewModels, StreamType.Person); return viewModel; }
private RssSubscriptionIndexViewModel GetRssSubscriptionIndexViewModel(long subscriptionId, ShowReadEntries showReadEntries) { var currentUserId = this.sessionProvider.GetCurrentUserId(); if (!this.rssSubscriptionsRepository.DoesUserOwnsSubscription(subscriptionId, currentUserId)) { var ci = new ChannelInformationViewModel { Title = "You are not subscribed to this channel", Created = DateTime.MaxValue }; var rssSubscriptionIndexViewModel = new RssSubscriptionIndexViewModel( subscriptionId, ci, new List <RssEntryToReadViewModel>(), StreamType.Rss); return(rssSubscriptionIndexViewModel); } var loadAllRssEntriesForUserAndChannel = showReadEntries != ShowReadEntries.Show ? this.rssToReadRepository.LoadAllUnreadEntriesFromSubscription(subscriptionId) : this.rssToReadRepository.LoadAllEntriesFromSubscription(subscriptionId); var channelInformation = this.rssSubscriptionsRepository.LoadChannelInformation(subscriptionId); var channelInformationViewModel = new ChannelInformationViewModel { Title = channelInformation.Title, Created = channelInformation.Created }; var rssEntryToReadViewModels = this.mapper.Map <List <RssEntryToReadViewModel> >(loadAllRssEntriesForUserAndChannel); var viewModel = new RssSubscriptionIndexViewModel( subscriptionId, channelInformationViewModel, rssEntryToReadViewModels, StreamType.Rss); viewModel.SubscriptionId = subscriptionId; return(viewModel); }
private RssSubscriptionIndexViewModel GetRssSubscriptionIndexViewModel(long subscriptionId, ShowReadEntries showReadEntries) { var currentUserId = this.authentication.GetCurrentUserId(); if (!this.rssSubscriptionsRepository.DoesUserOwnsSubscription(subscriptionId, currentUserId)) { var ci = new ChannelInformationViewModel { Title = "You are not subscribed to this channel", Created = DateTime.MaxValue }; var rssSubscriptionIndexViewModel = new RssSubscriptionIndexViewModel( subscriptionId, ci, new List<RssEntryToReadViewModel>(), StreamType.Rss); return rssSubscriptionIndexViewModel; } var loadAllRssEntriesForUserAndChannel = showReadEntries != ShowReadEntries.Show ? this.rssToReadRepository.LoadAllUnreadEntriesFromSubscription(subscriptionId) : this.rssToReadRepository.LoadAllEntriesFromSubscription(subscriptionId); var channelInformation = this.rssSubscriptionsRepository.LoadChannelInformation(subscriptionId); var channelInformationViewModel = new ChannelInformationViewModel { Title = channelInformation.Title, Created = channelInformation.Created }; var rssEntryToReadViewModels = this.mapper.Map<List<RssEntryToReadDTO>, List<RssEntryToReadViewModel>>(loadAllRssEntriesForUserAndChannel); var viewModel = new RssSubscriptionIndexViewModel( subscriptionId, channelInformationViewModel, rssEntryToReadViewModels, StreamType.Rss); viewModel.SubscriptionId = subscriptionId; return viewModel; }