Search in sources :

Example 1 with ProductUpdateDTO

use of com.ncedu.fooddelivery.api.v1.dto.product.ProductUpdateDTO in project 2021-msk-food-delivery by netcracker-edu.

the class ProductServiceImpl method updateProduct.

@Override
public void updateProduct(Long id, ProductUpdateDTO updatedProduct) {
    Product product = getProductById(id);
    productMapper.updateToEntity(product, updatedProduct);
    productRepo.save(product);
}
Also used : Product(com.ncedu.fooddelivery.api.v1.entities.Product)

Example 2 with ProductUpdateDTO

use of com.ncedu.fooddelivery.api.v1.dto.product.ProductUpdateDTO in project 2021-msk-food-delivery by netcracker-edu.

the class ProductUtils method createProductUpdateDTO.

public static ProductUpdateDTO createProductUpdateDTO(Product p) {
    ProductUpdateDTO productDTO = new ProductUpdateDTO();
    productDTO.setDescription(p.getDescription());
    productDTO.setPrice(p.getPrice());
    productDTO.setName(p.getName());
    productDTO.setWeight(p.getWeight());
    productDTO.setExpirationDays(p.getExpirationDays());
    return productDTO;
}
Also used : ProductUpdateDTO(com.ncedu.fooddelivery.api.v1.dto.product.ProductUpdateDTO)

Aggregations

ProductUpdateDTO (com.ncedu.fooddelivery.api.v1.dto.product.ProductUpdateDTO)1 Product (com.ncedu.fooddelivery.api.v1.entities.Product)1