public async Task <ActionResult> MakeReservation(ReservationViewModel model) { if (ModelState.IsValid) { var currentUser = User.FindFirstValue(ClaimTypes.NameIdentifier); var customerRecord = await _customerRepo.GetCustomerRecordByUserId(currentUser); model.CustomerID = customerRecord.CustID; await _reserveRepo.AddNewReservation(model); var currentReservation = await _reserveRepo.GetCurrentReservationsByCustomer(model); var currentResID = currentReservation.FirstOrDefault(x => DateTime.Now.CompareTo(x.DateOfBooking.Value) >= 0 && x.RoomTypeID == model.RoomTypeID).ResID; return(RedirectToAction("Create", "Payments", new { reservationId = currentResID })); } model.RoomTypes = await _roomRepo.GetAllRoomTypes(); model.Rooms = await _roomRepo.GetAllRooms(); ViewBag.NumberOfGuests = GetListOfAllowedGuests(); ViewBag.NumberOfRooms = GetListOfAllowedRooms(); return(View(model)); }