コード例 #1
0
        public async Task <ActionResult <GenericCommandResult> > Update(
            [FromBody] UpdateBookCommand command,
            [FromServices] ProductHandler handler,
            [FromServices] IProductRepository repository,
            int id
            )
        {
            var book = repository.GetById(id);

            if (book == null)
            {
                return(BadRequest());
            }

            command.MergeEntity(book);

            var result = handler.Handle(command);

            return(Ok(result));
        }