示例#1
0
 public override Task <Author> GetAuthorById(AuthorQuery request, ServerCallContext context)
 {
     return(Task.FromResult(new Author
     {
         Name = "2"
     }));
 }
示例#2
0
        public async Task <IList <AuthorAdminViewModel> > Handle(AuthorQuery request, CancellationToken cancellationToken)
        {
            var listAuthorMap = _mapper.Map <IList <AuthorAdminViewModel> >
                                    (await _context.Authors.Include(u => u.Books).ToListAsync(cancellationToken));

            return(listAuthorMap);
        }
示例#3
0
        public async Task <IActionResult> Author(int authorId)
        {
            var query       = new AuthorQuery(authorId);
            var queryResult = await _mediator.Send(query);

            var model = new AuthorViewModel()
            {
                Author = queryResult.Author
            };

            return(View(model));
        }
示例#4
0
        public async Task <ActionResult <AuthorQueryResponse> > Author([FromRoute] AuthorQuery query)
        {
            var result = await _queryBus.ExecuteAsync <AuthorQuery, AuthorQueryResponse>(query);

            return(Ok(result));
        }
 public GraphQLSandboxSchema(AuthorService authorService, IServiceProvider provider) : base(provider)
 {
     Query = new AuthorQuery(authorService);
 }