Package balu.pizza.webapp.services
Class CafeService
java.lang.Object
balu.pizza.webapp.services.CafeService
Cafe Service
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addPizzaToCafe
(int cafeId, int pizzaId) Adds pizza to the cafe menuSave new Cafe to DBvoid
delPizzaFromCafe
(int cafeId, int pizzaId) Remove pizza from cafe manufindAll()
findById
(int id) Find Cafe by IDUpdate cafe ib DB
-
Constructor Details
-
CafeService
- Parameters:
cafeRepository
- Cafe RepositorypizzaRepository
- Pizza Repository
-
-
Method Details
-
findById
Find Cafe by ID- Parameters:
id
-- Returns:
- Cafe or throw NotFoundException
-
findAll
- Returns:
- List of all cafes from DB
-
create
Save new Cafe to DB- Parameters:
cafe
-- Returns:
- saved cafe
-
findAllSorted
- Returns:
- Sorted by title list of all cafes from DB
-
update
Update cafe ib DB- Parameters:
cafe
-- Returns:
- updated cafe
-
addPizzaToCafe
@Transactional public void addPizzaToCafe(int cafeId, int pizzaId) Adds pizza to the cafe menu- Parameters:
cafeId
- Cafe idpizzaId
- Pizza id
-
delPizzaFromCafe
@Transactional public void delPizzaFromCafe(int cafeId, int pizzaId) Remove pizza from cafe manu- Parameters:
cafeId
- cafe IDpizzaId
- pizza ID
-