public void AddReservation(ReservationDto reservationDto, int userId) { Reservation reservation = _mapper.Map <Reservation>(reservationDto); if (reservation.Date < DateTime.Now) { throw new ValidationException("Reservation date cannot be before current"); } if (!_reservationRepository.CheckIfAvalible(reservation)) { throw new ValidationException("Given date is not avalible"); } if (!ValidateReservation(reservation)) { throw new ValidationException("Unavalible at given day"); } reservation.UserId = userId; reservation.Confirmed = false; _reservationRepository.Add(reservation); }