Index: src/main/java/com/example/salonbella/controller/reservation/ReservationAdminController.java
===================================================================
--- src/main/java/com/example/salonbella/controller/reservation/ReservationAdminController.java	(revision 0f3491d058d3b33632a55dae8783810ed77e16f9)
+++ src/main/java/com/example/salonbella/controller/reservation/ReservationAdminController.java	(revision 0f3491d058d3b33632a55dae8783810ed77e16f9)
@@ -0,0 +1,98 @@
+package com.example.salonbella.controller.reservation;
+
+import com.example.salonbella.service.reservation.ReservationResponse;
+import com.example.salonbella.service.reservation.ReservationService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.servlet.ModelAndView;
+import org.springframework.web.servlet.View;
+
+import javax.servlet.http.HttpServletRequest;
+import java.text.ParseException;
+import java.util.List;
+
+@Controller
+public class ReservationAdminController {
+
+    private final ReservationService reservationService;
+
+    @Autowired
+    public ReservationAdminController(ReservationService reservationService) {
+        this.reservationService = reservationService;
+    }
+
+
+    @GetMapping("/admin-scheduled-reservations")
+    public String getScheduledReservations() {
+        return "admin-reservations";
+    }
+
+    @GetMapping("/admin-block-reservation")
+    public String getBlockReservationPage() {
+        return "admin-block-reservation";
+    }
+
+    @GetMapping("/admin-schedule-reservation")
+    public String getReservationPage() {
+        return "admin-schedule-reservation";
+    }
+
+    @GetMapping("/admin-get-blocked-reservations")
+    public String getBlockedReservations(Model model) {
+        List<ReservationResponse> list = reservationService.getBlockedReservations();
+        model.addAttribute("reservations", list);
+        return "admin-blocked-reservations";
+    }
+
+    @PostMapping("/admin-get-scheduled-reservations")
+    public String getScheduledReservations(@RequestParam("date") String date, @RequestParam("type") String type, Model model) {
+        List<ReservationResponse> reservations = reservationService.getScheduledReservations(date, type);
+        model.addAttribute("reservations", reservations);
+        model.addAttribute("date", date);
+        model.addAttribute("type", type);
+        return "admin-scheduled-reservations";
+    }
+
+    @PostMapping("/admin-cancel-reservation")
+    public ModelAndView cancelReservation(@RequestParam("id") String id, @RequestParam("date") String date,
+                                          @RequestParam("type") String type, HttpServletRequest request) {
+        reservationService.cancelReservationAdmin(Long.parseLong(id));
+        request.setAttribute(View.RESPONSE_STATUS_ATTRIBUTE, HttpStatus.TEMPORARY_REDIRECT);
+        request.setAttribute("date", date);
+        request.setAttribute("type", type);
+        return new ModelAndView("redirect:/admin-get-scheduled-reservations");
+    }
+
+
+    @PostMapping("/admin-block-reservation")
+    public String blockReservation(@RequestParam("date") String date, @RequestParam("type") String type, @RequestParam("time") String time) {
+        reservationService.blockReservation(date, time, type);
+        return "redirect:/adminDashboard";
+    }
+
+    @PostMapping("/admin-unblock-reservation")
+    public String unblockReservation(@RequestParam("id") String id) {
+        reservationService.unblockReservation(Long.parseLong(id));
+        return "redirect:/admin-get-blocked-reservations";
+    }
+
+    @PostMapping("/admin-get-free-reservations")
+    public String getFreeReservations(@RequestParam("date") String date, @RequestParam("type") String type, Model model) throws ParseException {
+        model.addAttribute("free_reservations", reservationService.getFreeReservations(date, type));
+        model.addAttribute("date", date);
+        model.addAttribute("tip", type);
+        return "admin-schedule-reservation";
+    }
+
+    @PostMapping("/admin-make-reservation")
+    public String makeReservation(@RequestParam("date") String date, @RequestParam("type") String type, @RequestParam("time") String time) {
+        reservationService.makeReservation(date, time, type);
+        return "redirect:/adminDashboard";
+    }
+
+}
Index: src/main/java/com/example/salonbella/controller/reservation/ReservationUserController.java
===================================================================
--- src/main/java/com/example/salonbella/controller/reservation/ReservationUserController.java	(revision 0f3491d058d3b33632a55dae8783810ed77e16f9)
+++ src/main/java/com/example/salonbella/controller/reservation/ReservationUserController.java	(revision 0f3491d058d3b33632a55dae8783810ed77e16f9)
@@ -0,0 +1,58 @@
+package com.example.salonbella.controller.reservation;
+
+import com.example.salonbella.service.reservation.ReservationResponse;
+import com.example.salonbella.service.reservation.ReservationService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import java.text.ParseException;
+import java.util.List;
+
+@Controller
+public class ReservationUserController {
+
+    private final ReservationService reservationService;
+
+    @Autowired
+    public ReservationUserController(ReservationService reservationService) {
+        this.reservationService = reservationService;
+    }
+
+    @GetMapping("/schedule-reservation")
+    public String getUserPage() {
+        return "user-schedule-reservation";
+    }
+
+    @GetMapping("/my-reservations")
+    public String getReservationsUser(Model model) {
+        List<ReservationResponse> reservations = reservationService.getUserReservations();
+        model.addAttribute("reservations", reservations);
+        return "user-my-reservations";
+    }
+
+    @PostMapping("/get-free-reservations")
+    public String getFreeReservations(@RequestParam("date") String date, @RequestParam("type") String type, Model model) throws ParseException {
+        model.addAttribute("free_reservations", reservationService.getFreeReservations(date, type));
+        model.addAttribute("date", date);
+        model.addAttribute("tip", type);
+        return "user-schedule-reservation";
+    }
+
+    @PostMapping("/make-reservation")
+    public String makeReservation(@RequestParam("date") String date, @RequestParam("type") String type, @RequestParam("time") String time) {
+        reservationService.makeReservation(date, time, type);
+        return "redirect:/userDashboard";
+    }
+
+    @PostMapping("/cancel-reservation")
+    public String cancelReservation(@RequestParam("id") String id) {
+        reservationService.cancelReservation(Long.parseLong(id));
+        return "redirect:/my-reservations";
+    }
+
+
+}
Index: src/main/java/com/example/salonbella/entity/ReservationEntity.java
===================================================================
--- src/main/java/com/example/salonbella/entity/ReservationEntity.java	(revision 0f3491d058d3b33632a55dae8783810ed77e16f9)
+++ src/main/java/com/example/salonbella/entity/ReservationEntity.java	(revision 0f3491d058d3b33632a55dae8783810ed77e16f9)
@@ -0,0 +1,71 @@
+package com.example.salonbella.entity;
+
+import javax.persistence.*;
+import java.time.LocalDateTime;
+
+@Entity
+@Table(name = "reservations")
+public class ReservationEntity {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    private Long id;
+
+
+    @Column(name = "type", nullable = false, length = 30)
+    private String type;
+
+    @Column(name = "date_and_time", nullable = false, length = 30)
+    private LocalDateTime dateTime;
+
+    @Column(name = "valid", nullable = false)
+    private boolean valid = true;
+
+    @ManyToOne
+    @JoinColumn(name = "user_id", nullable = false)
+    private UserEntity user;
+
+
+    public ReservationEntity() {
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public LocalDateTime getDateTime() {
+        return dateTime;
+    }
+
+    public void setDateTime(LocalDateTime dateTime) {
+        this.dateTime = dateTime;
+    }
+
+    public void setUser(UserEntity user) {
+        this.user = user;
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public UserEntity getUser() {
+        return user;
+    }
+
+    public void setValid(boolean valid) {
+        this.valid = valid;
+    }
+
+    public boolean isValid() {
+        return valid;
+    }
+}
Index: src/main/java/com/example/salonbella/entity/UserEntity.java
===================================================================
--- src/main/java/com/example/salonbella/entity/UserEntity.java	(revision 74af3946a75d5e098b56a553852617e1cea48bee)
+++ src/main/java/com/example/salonbella/entity/UserEntity.java	(revision 0f3491d058d3b33632a55dae8783810ed77e16f9)
@@ -35,5 +35,6 @@
     private boolean valid = false;
 
-
+    @OneToMany(mappedBy = "user", cascade = CascadeType.ALL, orphanRemoval = true)
+    private Set<ReservationEntity> reservations;
 
     public UserEntity() {
Index: src/main/java/com/example/salonbella/repository/ReservationRepository.java
===================================================================
--- src/main/java/com/example/salonbella/repository/ReservationRepository.java	(revision 0f3491d058d3b33632a55dae8783810ed77e16f9)
+++ src/main/java/com/example/salonbella/repository/ReservationRepository.java	(revision 0f3491d058d3b33632a55dae8783810ed77e16f9)
@@ -0,0 +1,20 @@
+package com.example.salonbella.repository;
+
+import com.example.salonbella.entity.ReservationEntity;
+import com.example.salonbella.entity.UserEntity;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+import java.time.LocalDateTime;
+import java.util.List;
+
+@Repository
+public interface ReservationRepository extends JpaRepository<ReservationEntity, Long> {
+    List<ReservationEntity> findByTypeAndDateTimeBetween(String type,LocalDateTime start, LocalDateTime end);
+
+    List<ReservationEntity> findAllByUser(UserEntity user);
+
+    List<ReservationEntity> findAllByValid(boolean valid);
+
+    ReservationEntity findReservationEntityByDateTimeAndType(LocalDateTime dateTime, String type);
+}
Index: src/main/java/com/example/salonbella/service/reservation/ReservationResponse.java
===================================================================
--- src/main/java/com/example/salonbella/service/reservation/ReservationResponse.java	(revision 0f3491d058d3b33632a55dae8783810ed77e16f9)
+++ src/main/java/com/example/salonbella/service/reservation/ReservationResponse.java	(revision 0f3491d058d3b33632a55dae8783810ed77e16f9)
@@ -0,0 +1,72 @@
+package com.example.salonbella.service.reservation;
+
+import java.time.LocalDateTime;
+
+public class ReservationResponse {
+    private Long id;
+    private LocalDateTime localDateTime;
+    private String type;
+    private boolean valid;
+    private String name = "";
+    private String surname = "";
+
+    public ReservationResponse(Long id, LocalDateTime localDateTime, String type,boolean valid) {
+        this.id = id;
+        this.localDateTime = localDateTime;
+        this.type = type;
+        this.valid = valid;
+    }
+
+    public LocalDateTime getLocalDateTime() {
+        return localDateTime;
+    }
+
+    public void setLocalDateTime(LocalDateTime localDateTime) {
+        this.localDateTime = localDateTime;
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getSurname() {
+        return surname;
+    }
+
+    public void setSurname(String surname) {
+        this.surname = surname;
+    }
+
+    public boolean isValid() {
+        return valid;
+    }
+
+    public void setValid(boolean valid) {
+        this.valid = valid;
+    }
+
+    @Override
+    public String toString() {
+        return String.format("Date and time: %s\n Type: %s", localDateTime, type);
+    }
+}
Index: src/main/java/com/example/salonbella/service/reservation/ReservationService.java
===================================================================
--- src/main/java/com/example/salonbella/service/reservation/ReservationService.java	(revision 0f3491d058d3b33632a55dae8783810ed77e16f9)
+++ src/main/java/com/example/salonbella/service/reservation/ReservationService.java	(revision 0f3491d058d3b33632a55dae8783810ed77e16f9)
@@ -0,0 +1,182 @@
+package com.example.salonbella.service.reservation;
+
+import com.example.salonbella.entity.ReservationEntity;
+import com.example.salonbella.entity.UserEntity;
+import com.example.salonbella.repository.ReservationRepository;
+import com.example.salonbella.repository.UserRepository;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.stereotype.Service;
+
+import javax.transaction.Transactional;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+
+@Service
+public class ReservationService {
+
+    private final ReservationRepository reservationRepository;
+    private final UserRepository userRepository;
+
+    @Autowired
+    public ReservationService(ReservationRepository reservationRepository, UserRepository userRepository) {
+        this.reservationRepository = reservationRepository;
+        this.userRepository = userRepository;
+    }
+
+    // get all reservations for specified date and type
+    private List<ReservationEntity> getReservations(String date, String type) {
+        LocalDateTime start = stringToDateAndTime(date, "00:00");
+        LocalDateTime end = stringToDateAndTime(date, "23:59");
+        return reservationRepository.findByTypeAndDateTimeBetween(type, start, end);
+    }
+
+    // make reservation
+    public void makeReservation(String date, String time, String type) {
+        Authentication auth = SecurityContextHolder.getContext().getAuthentication();
+        String username = auth.getName();
+        UserEntity user = userRepository.findByUsername(username);
+        ReservationEntity reservationEntity = new ReservationEntity();
+        reservationEntity.setDateTime(stringToDateAndTime(date, time));
+        reservationEntity.setType(type);
+        reservationEntity.setUser(user);
+        reservationRepository.save(reservationEntity);
+    }
+
+    // convert string to localdatetime
+    private LocalDateTime stringToDateAndTime(String date, String time) {
+        int year = Integer.parseInt(date.split("-")[0]);
+        int month = Integer.parseInt(date.split("-")[1]);
+        int day = Integer.parseInt(date.split("-")[2]);
+        int hour = Integer.parseInt(time.split(":")[0]);
+        int minutes = Integer.parseInt(time.split(":")[1]);
+        LocalDate tempDate = LocalDate.of(year, month, day);
+        LocalTime tempTime = LocalTime.of(hour, minutes);
+        return LocalDateTime.of(tempDate, tempTime);
+    }
+
+    // get free reservations
+    public List<LocalTime> getFreeReservations(String date, String type) {
+
+        List<ReservationEntity> reservations = getReservations(date, type);
+        List<LocalTime> freeReservations = getWorkingHours();
+        for (ReservationEntity r : reservations) {
+            LocalTime temp = r.getDateTime().toLocalTime();
+            for (LocalTime l : freeReservations) {
+                if (temp.equals(l)) {
+                    freeReservations.remove(l);
+                    break;
+                }
+            }
+        }
+        return freeReservations;
+    }
+
+    // get all reservations for specified date and type
+    public List<ReservationResponse> getScheduledReservations(String date, String type) {
+        List<ReservationEntity> reservations = getReservations(date, type);
+        List<ReservationResponse> result = new ArrayList<>();
+        for (ReservationEntity r : reservations) {
+            ReservationResponse reservationResponse = new ReservationResponse(r.getId(), r.getDateTime(), r.getType(), r.isValid());
+            reservationResponse.setName(r.getUser().getName());
+            reservationResponse.setSurname(r.getUser().getSurname());
+            result.add(reservationResponse);
+        }
+        return result;
+    }
+
+    // get all user reservations, return another class for better security
+    public List<ReservationResponse> getUserReservations() {
+        UserEntity user = getUser();
+        List<ReservationEntity> reservationEntities = reservationRepository.findAllByUser(user);
+        List<ReservationResponse> result = new ArrayList<>();
+        for (ReservationEntity r : reservationEntities) {
+            result.add(new ReservationResponse(r.getId(), r.getDateTime(), r.getType(), r.isValid()));
+        }
+        return result;
+    }
+
+
+    // get current user
+    public UserEntity getUser() {
+        Authentication auth = SecurityContextHolder.getContext().getAuthentication();
+        String username = auth.getName();
+        UserEntity user = userRepository.findByUsername(username);
+        return user;
+    }
+
+    // cancel reservation - user
+    @Transactional
+    public void cancelReservation(Long id) {
+        Optional<ReservationEntity> reservationEntity = reservationRepository.findById(id);
+        if (reservationEntity.isPresent()) {
+            if (getUser().getId().equals(reservationEntity.get().getUser().getId())) {
+                reservationRepository.delete(reservationEntity.get());
+            }
+        }
+    }
+
+    // cancel reservation - user
+    @Transactional
+    public void cancelReservationAdmin(Long id) {
+        Optional<ReservationEntity> reservationEntity = reservationRepository.findById(id);
+        reservationEntity.ifPresent(reservationRepository::delete);
+    }
+
+    // block reservation
+
+    public void blockReservation(String date, String time, String type) {
+        Optional<ReservationEntity> reservationEntity = Optional.ofNullable(reservationRepository.findReservationEntityByDateTimeAndType(stringToDateAndTime(date, time), type));
+        if (reservationEntity.isPresent()) {
+            reservationEntity.get().setValid(false);
+            reservationRepository.save(reservationEntity.get());
+        } else {
+            ReservationEntity reservation = new ReservationEntity();
+            reservation.setDateTime(stringToDateAndTime(date, time));
+            reservation.setType(type);
+            reservation.setValid(false);
+            reservation.setUser(getUser());
+            reservationRepository.save(reservation);
+        }
+    }
+
+    // get blocked reservations
+    public List<ReservationResponse> getBlockedReservations() {
+        List<ReservationEntity> reservationEntities = reservationRepository.findAllByValid(false);
+        List<ReservationResponse> result = new ArrayList<>();
+        for (ReservationEntity r : reservationEntities) {
+            result.add(new ReservationResponse(r.getId(), r.getDateTime(), r.getType(), r.isValid()));
+        }
+        return result;
+    }
+
+    // unblock reservation
+    @Transactional
+    public void unblockReservation(Long id) {
+        Optional<ReservationEntity> reservationEntity = reservationRepository.findById(id);
+        if (reservationEntity.isPresent()) {
+            if (reservationEntity.get().getUser().getName().equals("admin")) {
+                reservationRepository.delete(reservationEntity.get());
+            } else {
+                reservationEntity.get().setValid(true);
+            }
+        }
+    }
+
+    // get working hours for salon
+    public List<LocalTime> getWorkingHours() {
+        List<LocalTime> temp = new ArrayList<>();
+        for (int i = 9; i <= 21; i++) {
+            temp.add(LocalTime.of(i, 0));
+        }
+        return temp;
+    }
+
+
+}
+
