mirror of https://github.com/abpframework/abp.git
csharpabpc-sharpframeworkblazoraspnet-coredotnet-coreaspnetcorearchitecturesaasdomain-driven-designangularmulti-tenancy
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.4 KiB
42 lines
1.4 KiB
using System.Collections.Generic;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
|
using Volo.Blogging.Blogs;
|
|
using Volo.Blogging.Posts;
|
|
using Volo.Blogging.Tagging;
|
|
using Volo.Blogging.Tagging.Dtos;
|
|
|
|
namespace Volo.Blogging.Pages.Blog.Posts
|
|
{
|
|
public class IndexModel : PageModel
|
|
{
|
|
private readonly IPostAppService _postAppService;
|
|
private readonly IBlogAppService _blogAppService;
|
|
private readonly ITagAppService _tagAppService;
|
|
|
|
[BindProperty(SupportsGet = true)]
|
|
public string BlogShortName { get; set; }
|
|
|
|
[BindProperty(SupportsGet = true)]
|
|
public string TagName { get; set; }
|
|
|
|
public IReadOnlyList<PostWithDetailsDto> Posts { get; set; }
|
|
|
|
public IReadOnlyList<TagDto> PopularTags { get; set; }
|
|
|
|
public IndexModel(IPostAppService postAppService, IBlogAppService blogAppService, ITagAppService tagAppService)
|
|
{
|
|
_postAppService = postAppService;
|
|
_blogAppService = blogAppService;
|
|
_tagAppService = tagAppService;
|
|
}
|
|
|
|
public async Task OnGetAsync()
|
|
{
|
|
var blog = await _blogAppService.GetByShortNameAsync(BlogShortName);
|
|
Posts = (await _postAppService.GetListByBlogIdAndTagName(blog.Id, TagName)).Items;
|
|
PopularTags = (await _tagAppService.GetPopularTags(new GetPopularTagsInput {ResultCount = 10}));
|
|
}
|
|
}
|
|
}
|