source: src/main/java/com/example/autopartz/service/impl/OrderServiceImpl.java@ cab5859

main
Last change on this file since cab5859 was d4b888e, checked in by andrejtodorovski <82031894+andrejtodorovski@…>, 23 months ago

Added full functionality for adding review

  • Property mode set to 100644
File size: 955 bytes
Line 
1package com.example.autopartz.service.impl;
2
3import com.example.autopartz.model.Client;
4import com.example.autopartz.model.Order;
5import com.example.autopartz.repository.OrderRepository;
6import com.example.autopartz.service.OrderService;
7import org.springframework.stereotype.Service;
8
9import java.util.List;
10@Service
11public class OrderServiceImpl implements OrderService {
12 private final OrderRepository orderRepository;
13
14 public OrderServiceImpl(OrderRepository orderRepository) {
15 this.orderRepository = orderRepository;
16 }
17
18 @Override
19 public List<Order> findAll() {
20 return orderRepository.findAll();
21 }
22
23 @Override
24 public Order create(Client user) {
25 return orderRepository.save(new Order(user));
26 }
27
28 @Override
29 public Order findById(Integer id) {
30 return orderRepository.findById(id).get();
31 }
32
33 @Override
34 public void save(Order o) {
35 orderRepository.save(o);
36 }
37}
Note: See TracBrowser for help on using the repository browser.