public async Task <IActionResult> CreateNewBooking(NewBooking booking)
        {
            try
            {
                DateTime[] formatedDates = BookingsHelper.formatDates(booking.startDate, booking.endDate);
                booking.startDate = formatedDates[0];
                booking.endDate   = formatedDates[1];

                List <string> errors = await BookingsHelper.validations(booking.startDate, booking.endDate, mySQLDBContext, booking.idRoom);

                errors.AddRange(BookingsHelper.validationsBooking(booking.startDate, booking.endDate, mySQLDBContext, booking.idRoom));

                if (errors.Count != 0)
                {
                    return(BadRequest(errors));
                }

                Bookings newBooking = new Bookings {
                    idRoom = booking.idRoom, startDate = booking.startDate, endDate = booking.endDate
                };
                await mySQLDBContext.AddAsync(newBooking);

                await mySQLDBContext.SaveChangesAsync();

                return(Ok(newBooking));
            }
            catch (Exception e)
            {
                logger.LogError(e.Message);
                return(StatusCode(500));
            }
        }
        public async Task <IActionResult> modifyBooking(Bookings booking)
        {
            try
            {
                DateTime[] formatedDates = BookingsHelper.formatDates(booking.startDate, booking.endDate);
                booking.startDate = formatedDates[0];
                booking.endDate   = formatedDates[1];

                Bookings databaseBooking = await mySQLDBContext.Bookings.FindAsync(booking.id);

                if (databaseBooking == null)
                {
                    return(NotFound());
                }

                List <string> errors = await BookingsHelper.validations(booking.startDate, booking.endDate, mySQLDBContext, booking.idRoom);

                errors.AddRange(BookingsHelper.validationsBooking(booking.startDate, booking.endDate, mySQLDBContext, booking.idRoom, false, booking.id));

                if (errors.Count != 0)
                {
                    return(BadRequest(errors));
                }

                databaseBooking.startDate = booking.startDate;
                databaseBooking.endDate   = booking.endDate;
                await mySQLDBContext.SaveChangesAsync();

                return(Ok(databaseBooking));
            }
            catch (Exception e)
            {
                logger.LogError(e.Message);
                return(StatusCode(500));
            }
        }