コード例 #1
0
        public async Task <Product> UpdateProduct([FromRoute] Guid productId,
                                                  [FromBody] UpdateProductInfoCommand request)
        {
            request.Id = productId;

            return(await _mediator.Send(request));
        }
コード例 #2
0
        public Product UpdateBasicInformation(UpdateProductInfoCommand command)
        {
            var product = _repository.Get(command.Id);

            product.UpdateInfo(command.Title, command.Description, command.CategoryId);
            _repository.Update(product);

            return(Commit() ? product : null);
        }
コード例 #3
0
        public Task <HttpResponseMessage> Put(int id, [FromBody] dynamic body)
        {
            var command = new UpdateProductInfoCommand(
                id: id,
                title: (string)body.title,
                category: (int)body.category,
                description: (string)body.description
                );

            var product = _service.UpdateBasicInformation(command);

            return(CreateResponse(HttpStatusCode.OK, product));
        }
コード例 #4
0
 public async Task <IProcessResult> Put(UpdateProductInfoCommand command) => await mediator.Send(command);