1
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") @PostMapping(value = "/product/add")
public @ResponseBody public @ResponseBody
String addProduct(@RequestBody Product product){ Product addProduct(@RequestBody Product product){
productService.addProduct(product); return productService.addProduct(product);
return "Jak się bawisz Kondradzie?";
} }
@DeleteMapping(value = "/product/delete") @DeleteMapping(value = "/product/delete")
public @ResponseBody public @ResponseBody
String deleteProduct(@RequestBody IdDto id){ String deleteProduct(@RequestBody IdDto id){
productService.deleteProduct(id.getId()); productService.deleteProduct(id.getId());
return "(y)"; return "Deleted" + id;
} }
@GetMapping(value = "/product/get-by-id") @GetMapping(value = "/product/get-by-id")

View File

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

View File

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