예제 #1
0
        public IActionResult View([FromServices] BlogQueryFactory blogQueryFactory, BlogFromIdQuery query)
        {
            var blog      = blogQueryFactory.Build(query).Get();
            var viewModel = _mapper.Map <BlogViewModel>(blog);

            viewModel.IsOwner = blog.OwnerId == _userManager.GetUserId(User);
            return(View(viewModel));
        }
예제 #2
0
        public async Task <IActionResult> Index([FromServices] BlogQueryFactory blogFactory)
        {
            var query = new AllBlogsQueryAsync();
            var blogs = await blogFactory.Build(query).Get().ToList();

            var viewModel = _mapper.Map <BlogIndexViewModel>(blogs);

            return(View(viewModel));
        }