public ActionResult UpdateFacilityReservation(string selectedFacResId, string selectedGusResID) { // Retrieve all facility based on Mod 3 Team 06 function List <PublicAreaDTO> fullfacilityList = _publicArea.getAllFacilityResults(); // For loop to store existing facility to populate View Form DropDownList Dictionary <int, string> namefacilityList = new Dictionary <int, string>(); if (fullfacilityList.Count > 0) { foreach (PublicAreaDTO fac in fullfacilityList) { namefacilityList.Add(fac.public_area_id, fac.public_area_name); } } // This is to filter out unrelated record, only return the selected records FacilityReservation selectedID = _facilityReservationService.RetrieveByReservationId(int.Parse(selectedFacResId)); Dictionary <string, string> currentRecord = new Dictionary <string, string>(); currentRecord.Add("FacilityId", selectedID.FacilityIdDetails().ToString()); currentRecord.Add("ReservationId", selectedID.ReservationIdDetails().ToString()); currentRecord.Add("ReserveeId", selectedID.ReserveeIdDetails().ToString()); currentRecord.Add("StartTime", selectedID.StartTimeDetails().ToString("yyyy-MM-dd")); currentRecord.Add("EndTime", selectedID.EndTimeDetails().ToString("yyyy-MM-ddTHH:mm")); currentRecord.Add("Pax", selectedID.NumberOfPax().ToString()); currentRecord.Add("SGID", selectedGusResID); currentRecord.Add("SFID", selectedFacResId); // Retrieve all existing guests Guest guestList = _guestService.SearchByGuestId(int.Parse(selectedGusResID)); // For loop to store existing guest to populate View Form DropDownList Dictionary <int, string> existguestList = new Dictionary <int, string>(); existguestList.Add(guestList.GuestIdDetails(), guestList.FirstNameDetails() + " " + guestList.LastNameDetails()); // Passing data over to View Page via ViewBag ViewBag.currentRecord = currentRecord; ViewBag.existguestList = existguestList; ViewBag.namefacilityList = namefacilityList; return(View()); }