Ejemplo n.º 1
0
        public async Task <IActionResult> Index(GetTagsRequest request)
        {
            var tagPage = await _tagManager.GetAsync(request.ToQuery(PageSize), Cancel);

            var viewModel = new TagsViewModel(tagPage, request.Page);

            return(View(viewModel));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Edit(Guid storyId)
        {
            var story = await _blogStoryManager.GetWithTagsAsync(storyId, Cancel);

            var tagPage = await _tagManager.GetAsync(new TagsQuery(), Cancel);

            var viewModel = new EditBlogStoryViewModel(story, tagPage.Items, Url);

            return(View(viewModel));
        }
Ejemplo n.º 3
0
        public async Task <ActionResult> PatchTag([FromRoute] Guid tagId,
                                                  [FromBody] JsonPatchDocument <TagEditRequest> request)
        {
            var tag = await _tagManager.GetAsync(tagId, Cancel);

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

            var patchTag = new TagEditRequest(tag);

            request.ApplyTo(patchTag);

            var updatedTag = await _tagManager.UpdateAsync(patchTag.ToDomain(), Cancel);

            return(Ok(new { id = updatedTag.Id, name = updatedTag.Name }));
        }
Ejemplo n.º 4
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)));
        }
Ejemplo n.º 5
0
        public async Task <EntityDto <long> > GetTag(GetTagInput input)
        {
            var tag = await _tagManager.GetAsync(input.Text.Replace(" ", string.Empty));

            return(new EntityDto <long>(tag.Id));
        }