public async Task SetBookingStatus(string bookingId, ApproveBookingsBindingModel model)
        {
            var bookingToUpdate = await GetBookingById(bookingId);

            bookingToUpdate.Status = model.Status;

            await this.dbContext.SaveChangesAsync();
        }
        public async Task <IActionResult> ApproveBookings(ApproveBookingsBindingModel model, string id)
        {
            if (!this.ModelState.IsValid)
            {
                return(BadRequest(ModelState.Values.SelectMany(v => v.Errors).Select(error => error.ErrorMessage)));
            }

            await this.service.SetBookingStatus(id, model);

            return(RedirectToAction(nameof(this.BookingsInYourTeam)));
        }
        public Task <ApproveBookingsBindingModel> GetBookingForApprove(string id)
        {
            var booking = this.dbContext.Bookings
                          .Include(b => b.User)
                          .Include(b => b.BookingType)
                          .Where(b => b.Id == id)
                          .SingleOrDefault();

            var model = new ApproveBookingsBindingModel();

            model.FullName    = $"{booking.User.FirstName} {booking.User.LastName}";
            model.BookingType = booking.BookingType.Name;
            model.StartDate   = booking.StartDate;
            model.EndDate     = booking.EndDate;
            model.Status      = booking.Status;

            return(Task.FromResult(model));
        }