public async Task <ActionResult <AuthorApiViewModel> > Add(AuthorAddModel addModel)
        {
            Author result = await _mediator.Send(new AddAuthorCommand(addModel.Name, addModel.LastName, addModel.DateOfBirth));

            AuthorApiViewModel viewModel = AuthorApiMapper.MapToApiModel(result);

            return(Created(Url.RouteUrl("GetAuthorById", new { id = viewModel.Id }), viewModel));
        }
        [ProducesResponseType(typeof(Guid), (int)HttpStatusCode.NotFound)]         // NotFound
        public async Task <ActionResult <AuthorApiViewModel> > Get(Guid id)
        {
            Author result = await _mediator.Send(new GetAuthorByIdQuery(id));

            if (result is null)
            {
                return(NotFound(id));
            }

            AuthorApiViewModel viewModel = AuthorApiMapper.MapToApiModel(result);

            return(Ok(viewModel));
        }
        public async Task <ActionResult <AuthorApiViewModel> > Get(
            [ModelBinder(Name = "id")] Author author)
        // you have to use ModelBinder here because the default behavior gets
        //    overwritten by the ApiController
        {
            if (author is null)
            {
                return(NotFound());
            }

            // Mapping
            AuthorApiViewModel viewModel = AuthorApiMapper.MapToApiModel(author);

            return(Ok(await Task.FromResult(viewModel)));
        }