Exemplo n.º 1
0
        public async Task <IActionResult> GetAuthorById(long id)
        {
            var query  = new GetAuthorByIdQuery(id);
            var result = await _mediator.Send(query);

            return(result != null?Success(new { data = result }) : Error(new { info = "کاربری یافت نشد" }));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> GetAuthorById(int libraryId, int authorId, CancellationToken token = default(CancellationToken))
        {
            var query  = new GetAuthorByIdQuery(libraryId, authorId);
            var author = await _queryProcessor.ExecuteAsync(query, cancellationToken : token);

            if (author != null)
            {
                return(new OkObjectResult(_authorRenderer.Render(author, libraryId)));
            }

            return(new NotFoundResult());
        }