public async Task <Product> UpdateProduct([FromRoute] Guid productId, [FromBody] UpdateProductInfoCommand request) { request.Id = productId; return(await _mediator.Send(request)); }
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); }
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)); }
public async Task <IProcessResult> Put(UpdateProductInfoCommand command) => await mediator.Send(command);