0
0
forked from s434786/DINO_SCRUM

fix add endpoint

This commit is contained in:
prgres 2019-01-13 18:53:55 +01:00
parent 26c6c0f725
commit 0d4b2dcf75
3 changed files with 6 additions and 7 deletions

View File

@ -42,16 +42,15 @@ public class ProductController {
@PostMapping(value = "/product/add")
public @ResponseBody
String addProduct(@RequestBody Product product){
productService.addProduct(product);
return "Jak się bawisz Kondradzie?";
Product addProduct(@RequestBody Product product){
return productService.addProduct(product);
}
@DeleteMapping(value = "/product/delete")
public @ResponseBody
String deleteProduct(@RequestBody IdDto id){
productService.deleteProduct(id.getId());
return "(y)";
return "Deleted" + id;
}
@GetMapping(value = "/product/get-by-id")

View File

@ -15,6 +15,6 @@ public interface ProductService {
Product changeQuantity(QuantityChange quantityChange);
Product getById(Long id);
float getPriceOfAllProducts();
void addProduct(Product product);
Product addProduct(Product product);
void deleteProduct(long id);
}

View File

@ -63,8 +63,8 @@ public class ProductServiceImpl implements ProductService {
}
@Override
public void addProduct(Product product) {
productRepository.save(product);
public Product addProduct(Product product) {
return productRepository.save(product);
}
@Override