コード例 #1
0
ファイル: FeedsController.cs プロジェクト: AlissonRS/NewsFeed
        public async Task <IActionResult> Items(int feedId)
        {
            var feed = await feedRepository.GetFeedById(feedId);

            if (feed == null)
            {
                this.AddFrontendMessage(Web.ViewModels.Shared.MessageStatus.Danger, "Feed not found");
                return(RedirectToAction("Index", "Explore"));
            }
            var model = new FeedItemsViewModel();

            model.FeedId   = feedId;
            model.FeedName = feed.Name;
            model.Items    = await feedRepository
                             .GetItems(feedId)
                             .ProjectTo <FeedItemViewModel>(configurationProvider)
                             .OrderByDescending(i => i.CreatedAt)
                             .ToListAsync();

            return(View(model));
        }
コード例 #2
0
 public async Task <FeedModel> GetFeed(Guid idFeed)
 {
     return(await feedsRepository.GetFeedById(idFeed));
 }