public ActionResult ReadAjax(StreamType streamType, long id, ShowReadEntries showReadEntries = ShowReadEntries.Hide) { var entries = this.rssSubscriptionService .LoadAllUnreadRssEntriesToReadForCurrentUserFromSubscription(streamType, id, showReadEntries); var result = this.Json(entries, JsonRequestBehavior.AllowGet); return result; }
public ActionResult ReadAjax(StreamType streamType, long id, ShowReadEntries showReadEntries = ShowReadEntries.Hide) { var entries = this.rssSubscriptionService .LoadAllUnreadRssEntriesToReadForCurrentUserFromSubscription(streamType, id, showReadEntries); var result = this.Json(entries, JsonRequestBehavior.AllowGet); return(result); }
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.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; }
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); }
public RssSubscriptionIndexViewModel GetSubscriptionViewModel(long subscriptionId, ShowReadEntries showReadEntries) { return(this.GetPersonSubscriptionIndexViewModel(subscriptionId, showReadEntries)); }
public RssSubscriptionIndexViewModel LoadAllUnreadRssEntriesToReadForCurrentUserFromSubscription(StreamType streamType, long subscriptionId, ShowReadEntries showReadEntries) { var provider = this.subscriptionHandlerFactory.GetProvider(streamType); var viewmodel = provider.GetSubscriptionViewModel(subscriptionId, showReadEntries); return(viewmodel); }
public RssSubscriptionIndexViewModel GetSubscriptionViewModel(long subscriptionId, ShowReadEntries showReadEntries) { return this.GetPersonSubscriptionIndexViewModel(subscriptionId, showReadEntries); }
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); }
public RssSubscriptionIndexViewModel LoadAllUnreadRssEntriesToReadForCurrentUserFromSubscription(StreamType streamType, long subscriptionId, ShowReadEntries showReadEntries) { var provider = this.subscriptionHandlerFactory.GetProvider(streamType); var viewmodel = provider.GetSubscriptionViewModel(subscriptionId, showReadEntries); return viewmodel; }