public ActionResult LoadData(HotelsDeptSearchFilters searchFilters, int draw, int start, int length) { BookingSearchReq BookingReq = new BookingSearchReq(); HotelsDeptSearchRes BookingRes = new HotelsDeptSearchRes(); BookingReq.AgentName = searchFilters.AgentName; BookingReq.AgentCode = searchFilters.AgentCode; BookingReq.BookingNumber = searchFilters.CNKReferenceNo; BookingReq.BookingName = searchFilters.AgentTour; BookingReq.Status = searchFilters.BookingStatus; BookingReq.DateType = searchFilters.DateType; BookingReq.From = searchFilters.From; BookingReq.To = searchFilters.To; BookingReq.Start = start; if (length == 0) { length = 10; } BookingReq.Length = length; BookingRes = hotelsProviders.GetHotelsByBookingDetails(BookingReq, token).Result; //Duration Details for (int i = 0; i < BookingRes.BookingsDetails.Count; i++) { int duration = Convert.ToInt32(BookingRes.BookingsDetails[i].Duration); BookingRes.BookingsDetails[i].Duration = duration + "N/" + (duration + 1) + "D"; } //Rooming Details var rooms = ""; for (int i = 0; i < BookingRes.BookingsDetails.Count; i++) { if (BookingRes.BookingsDetails[i].BookingRooms != null && BookingRes.BookingsDetails[i].BookingRooms.Count > 0) { for (int j = 0; j < BookingRes.BookingsDetails[i].BookingRooms.Count; j++) { if (j > 0) { rooms = rooms + " , " + BookingRes.BookingsDetails[i].BookingRooms[j].ROOMNO + " x " + BookingRes.BookingsDetails[i].BookingRooms[j].SUBPROD; } else { rooms = BookingRes.BookingsDetails[i].BookingRooms[j].ROOMNO + " x " + BookingRes.BookingsDetails[i].BookingRooms[j].SUBPROD; } BookingRes.BookingsDetails[i].StrBookingRooms = rooms; } } } return(Json(new { draw = draw, recordsTotal = BookingRes.HotelsTotalCount, recordsFiltered = BookingRes.HotelsTotalCount, data = BookingRes.BookingsDetails })); }
public async Task <HotelsDeptSearchRes> GetHotelsByBookingDetails([FromBody] BookingSearchReq request) { var response = new HotelsDeptSearchRes(); try { if (request != null) { var result = await _hotelsRepository.GetHotelsByBookingDetails(request); if (result != null && result.BookingsDetails.Count > 0) { response.ResponseStatus.Status = "Success"; response.HotelsTotalCount = result.HotelsTotalCount; response.BookingsDetails = result.BookingsDetails.ToList(); } else { response.ResponseStatus.Status = "Success"; response.ResponseStatus.ErrorMessage = "No Records Found."; } } else { response.ResponseStatus.Status = "Failure"; response.ResponseStatus.ErrorMessage = "Booking details can not be blank."; } } catch (Exception ex) { response.ResponseStatus.Status = "Failure"; response.ResponseStatus.ErrorMessage = "An error occurs " + ex.Message; } return(response); }
public async Task <HotelsDeptSearchRes> GetHotelsByBookingDetails(BookingSearchReq bookingGetReq, string ticket) { HotelsDeptSearchRes HotelsDeptSearchRes = new HotelsDeptSearchRes(); HotelsDeptSearchRes = await serviceProxy.PostData(_configuration.GetValue <string>("ServiceHotels:GetHotelsByBookingDetails"), bookingGetReq, typeof(HotelsDeptSearchRes), ticket); return(HotelsDeptSearchRes); }