Beispiel #1
0
        public async Task <IActionResult> GetAtomFeed([FromServices] IOptions <FeedOptions> feedOptions,
                                                      [FromQuery] Int32 page = 1)
        {
            var storiesPage = await _blogStoryManager.GetPageWithTagsAsync(GetStoriesRequest.ToPublishedQuery(page, PageSize), Cancel);

            return(new AtomStoriesResult(storiesPage, feedOptions));
        }
Beispiel #2
0
        public async Task <IActionResult> Index(GetStoriesRequest request)
        {
            var storiesPage = await _blogStoryManager.GetPageAsync(request.ToQuery(PageSize), Cancel);

            var viewModel = new AuthorStoriesPageViewModel(storiesPage, request.Page, PageSize);

            return(View(viewModel));
        }
        public async Task <IActionResult> GetStories([FromQuery] GetStoriesRequest request)
        {
            var response = await mediator.Send(request);

            logger.LogResponse($"User #{HttpContext.GetCurrentUserId()} fetched stories", response.Error);

            return(response.IsSucceeded ? (IActionResult)Ok(response) : BadRequest(response));
        }
Beispiel #4
0
        public async Task <IActionResult> Index([FromQuery] Int32 page = 1)
        {
            var storiesPage = await _blogStoryManager.GetPageWithTagsAsync(GetStoriesRequest.ToPublishedQuery(page, PageSize), Cancel);

            var topTags = await _tagManager.GetTopPublishedAsync(Cancel);

            return(View("IndexPub", new MainPageViewModel(storiesPage,
                                                          topTags,
                                                          page)));
        }
Beispiel #5
0
        public async Task <IActionResult> Tags([FromRoute] String alias,
                                               [FromQuery] Int32 page = 1)
        {
            var tag = await _tagManager.GetAsync(alias, Cancel);

            if (tag == null)
            {
                return(NotFound());
            }

            var storiesByTag = await _blogStoryManager.GetPageWithTagsAsync(GetStoriesRequest.ToQuery(tag.Id, page, PageSize));

            var topTags = await _tagManager.GetTopPublishedAsync(Cancel);

            ViewBag.Title           = tag.SeoTitle;
            ViewBag.Description     = tag.SeoDescription;
            ViewBag.Keywords        = tag.SeoKeywords;
            ViewBag.NoFollowForTags = true;

            return(View("~/Views/BlogStory/IndexPub.cshtml",
                        new MainPageViewModel(storiesByTag,
                                              topTags,
                                              page)));
        }