public ReservationDtocs UpdateReservation(ReservationResponse reservation)
        {
            ReservationDtocs clientExist = _reservationApp.GetReservationClietntId(reservation.IdClient);

            if (clientExist == null)
            {
                new ReservationDtocs
                {
                    MessageError = "Client is Required"
                };
            }

            if (reservation.IdEvent == 0)
            {
                new ReservationDtocs
                {
                    MessageError = "Category Event is Required"
                };
            }

            ReservationDtocs newReserva = new ReservationDtocs
            {
                IdReservation = reservation.IdReservation,
                DateDue       = reservation.DateDue,
                IdClient      = reservation.IdClient,
                IdEvent       = reservation.IdEvent
            };

            ReservationDtocs response = _reservationApp.UpdateReservation(newReserva);

            return(response);
        }
        public ReservationDtocs AddReservation(ReservationResponse reservation)
        {
            var Finde = reservation.DateDue.DayOfWeek.Equals('5' & '6');
            var hours = reservation.DateDue.ToString("HH:mm tt");

            ReservationDtocs clientExist = _reservationApp.GetReservationClietntId(reservation.IdClient);

            if (clientExist == null)
            {
                new ReservationDtocs
                {
                    MessageError = "Client is Required"
                };
            }

            ClientDto clientDto = _clientRepository.GetClienteId(reservation.IdClient);

            if (clientDto.Age < 21 || clientDto.Status.Equals("Mora").Equals("Cancelado"))
            {
                new ReservationDtocs
                {
                    MessageError = "Cliente no apto para reserva"
                };
            }


            if (reservation.IdEvent == 0)
            {
                new ReservationDtocs
                {
                    MessageError = "Category Event is Required"
                };
            }

            if (reservation.DateDue.DayOfWeek.Equals('0'))
            {
                new ReservationDtocs
                {
                    MessageError = "Not reservations on Sunday"
                };
            }

            ReservationDtocs newReserva = new ReservationDtocs
            {
                IdReservation = reservation.IdReservation,
                DateDue       = reservation.DateDue,
                IdClient      = reservation.IdClient,
                IdEvent       = reservation.IdEvent
            };

            ReservationDtocs response = _reservationApp.AddReservation(newReserva);

            return(response);
        }
        public ReservationDtocs DeleteReservation(ReservationResponse reservation)
        {
            ReservationDtocs newReserva = new ReservationDtocs
            {
                IdReservation = reservation.IdReservation,
                DateDue       = reservation.DateDue,
                IdClient      = reservation.IdClient,
                IdEvent       = reservation.IdEvent
            };

            ReservationDtocs reservationDto = _reservationApp.DeleteReservation(newReserva);

            return(reservationDto);
        }
        public ReservationDtocs DeleteReservation(ReservationDtocs reservation)
        {
            var register = _context.reservationModels.FirstOrDefault(c => c.IdReservation == reservation.IdReservation);

            if (register == null)
            {
                return(new ReservationDtocs
                {
                    MessageError = "Not Found"
                });
            }

            _context.reservationModels.Remove(register);
            _context.SaveChanges();
            return(reservation);
        }
        public ReservationDtocs UpdateReservation(ReservationDtocs reservation)
        {
            var register = _context.reservationModels.FirstOrDefault(c => c.IdReservation == reservation.IdReservation);

            if (register == null)
            {
                return(new ReservationDtocs
                {
                    MessageError = "Not Found"
                });
            }

            register.IdEvent       = reservation.IdEvent;
            register.IdReservation = reservation.IdReservation;
            register.IdClient      = reservation.IdClient;
            register.DateDue       = reservation.DateDue;


            _context.SaveChanges();
            return(reservation);
        }
        public ReservationDtocs AddReservation(ReservationDtocs reservation)
        {
            if (reservation != null)
            {
                ReservationModel reservationModel = new ReservationModel
                {
                    DateDue  = reservation.DateDue,
                    IdClient = reservation.IdClient,
                    IdEvent  = reservation.IdEvent
                };

                _context.reservationModels.Add(reservationModel);
                _context.SaveChanges();
                reservation.IdEvent = reservationModel.IdEvent;

                return(reservation);
            }

            return(new ReservationDtocs
            {
                MessageError = "Empy Event"
            });
        }
        public ReservationDtocs GetReservationId(ReservationResponse reservation)
        {
            ReservationDtocs reservationDto = _reservationApp.GetReservationId(reservation.IdReservation);

            return(reservationDto);
        }
        public ReservationDtocs GetReservationClietntId(ReservationResponse reservation)
        {
            ReservationDtocs reservationDto = _reservationApp.GetReservationClietntId(reservation.IdClient);

            return(reservationDto);
        }
        public ReservationDtocs AddClient(ReservationDtocs reservation)
        {
            ReservationDtocs reservationDto = _resevationRepository.AddReservation(reservation);

            return(reservationDto);
        }
        public ReservationDtocs DeleteReservation(ReservationDtocs reservation)
        {
            ReservationDtocs reservationDto = _resevationRepository.DeleteReservation(reservation);

            return(reservationDto);
        }
        public ReservationDtocs UpdateReservation(ReservationDtocs reservation)
        {
            ReservationDtocs reservationDto = _resevationRepository.UpdateReservation(reservation);

            return(reservationDto);
        }
        public ReservationDtocs GetReservationId(int id)
        {
            ReservationDtocs reservationDto = _resevationRepository.GetReservationId(id);

            return(reservationDto);
        }