public Product UpdateBasicInformation(UpdateProductInfoCommand command)
        {
            var product = _repository.Get(command.Id);
            product.UpdateInfo(command.Title, command.Description, command.CategoryId);
            _repository.Update(product);

            if (Commit())
                return product;

            return null;
        }
Exemplo n.º 2
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);
        }