public JsonResult SaveSimilarHotels(SimilarHotelsViewModel model) { SimilarHotelsSetRes response = new SimilarHotelsSetRes(); SimilarHotelsSetReq request = new SimilarHotelsSetReq(); request.PositionId = model.PositionId; request.ProductId = model.ProductId; request.SelectedHotelList = model.SelectedHotelList; request.BlacklistedHotelList = model.BlackListedHotelList; request.EditUser = ckUserEmailId; //request.Caller = ""; request.IsClone = model.IsClone; request.Caller = model.Caller; request.BookingNumber = model.BookingNumber; response = masterProviders.SetSimilarHotels(request, token).Result; if (response != null && response.ResponseStatus != null) { return Json(new { status = response.ResponseStatus.Status, msg = response.ResponseStatus.ErrorMessage }); } else { return Json(new { status = "Error", msg = "Details not updated" }); } }
public ActionResult GetSimilarHotels(string BookingNumber, string PositionId) { try { HotelAlternateServicesGetRes response = hotelsProviders.GetAlternateServicesByBooking(new HotelAlternateServicesGetReq() { BookingNumber = BookingNumber, PositionId = PositionId }, token).Result; SimilarHotelsViewModel model = new SimilarHotelsViewModel() { Caller = "bookings", BookingNumber = BookingNumber }; if (response.AlternateServices.Count > 0) { model.SelectedHotelList = response.AlternateServices.Where(a => a.IsBlackListed == null || a.IsBlackListed == false) .Select(b => new ProductList { Category = b.Attributes != null ? b.Attributes.BdgPriceCategory : "", Location = b.Attributes != null ? b.Attributes.Location : "", StarRating = b.Attributes != null ? b.Attributes.StarRating : "", VoyagerProductId = b.Product_Id, Name = b.Product_Name, Supplier = b.SupplierInfo?.Name, SupplierId = b.SupplierInfo?.Id, LocationInfo = new ProductLocation { CityName = b.City, CountryName = b.Country } }).OrderBy(a => a.Name).ToList(); model.BlackListedHotelList = response.AlternateServices.Where(a => a.IsBlackListed == true) .Select(b => new ProductList { Category = b.Attributes.BdgPriceCategory, Location = b.Attributes.Location, StarRating = b.Attributes.StarRating, VoyagerProductId = b.Product_Id, Name = b.Product_Name, Supplier = b.SupplierInfo?.Name, SupplierId = b.SupplierInfo?.Id, LocationInfo = new ProductLocation { CityName = b.City, CountryName = b.Country } }).OrderBy(a => a.Name).ToList(); foreach (var hotel in model.SelectedHotelList) { hotel.VoyagerProductId = hotel.VoyagerProductId + "|" + hotel.SupplierId; hotel.Name = hotel.Name + " ("; if (!string.IsNullOrEmpty(hotel.LocationInfo.CityName)) { hotel.Name = hotel.Name + hotel.LocationInfo.CityName; } if (!string.IsNullOrEmpty(hotel.StarRating)) { hotel.Name = hotel.Name + ", " + hotel.StarRating; } if (!string.IsNullOrEmpty(hotel.Category)) { hotel.Name = hotel.Name + "/" + hotel.Category; } if (!string.IsNullOrEmpty(hotel.Location)) { hotel.Name = hotel.Name + "/" + hotel.Location; } if (!string.IsNullOrEmpty(hotel.Supplier)) { hotel.Name = hotel.Name + "/" + hotel.Supplier; } hotel.Name = hotel.Name + ")"; } foreach (var hotel in model.BlackListedHotelList) { hotel.VoyagerProductId = hotel.VoyagerProductId + "|" + hotel.SupplierId; hotel.Name = hotel.Name + " ("; if (!string.IsNullOrEmpty(hotel.LocationInfo.CityName)) { hotel.Name = hotel.Name + hotel.LocationInfo.CityName; } if (!string.IsNullOrEmpty(hotel.StarRating)) { hotel.Name = hotel.Name + ", " + hotel.StarRating; } if (!string.IsNullOrEmpty(hotel.Category)) { hotel.Name = hotel.Name + "/" + hotel.Category; } if (!string.IsNullOrEmpty(hotel.Location)) { hotel.Name = hotel.Name + "/" + hotel.Location; } if (!string.IsNullOrEmpty(hotel.Supplier)) { hotel.Name = hotel.Name + "/" + hotel.Supplier; } hotel.Name = hotel.Name + ")"; } } return(PartialView("~/Views/Accomodation/_SimilarHotels.cshtml", model)); } catch (Exception ex) { return(PartialView("~/Views/Accomodation/_SimilarHotels.cshtml")); } }
public ActionResult GetSimilarHotels(SimilarHotelsGetReq request, string HotelName, string CityName, string CountryName, string StarRating, string BudgetCategory, string Location, string EnquiryPipeline) { SimilarHotelsViewModel model = new SimilarHotelsViewModel(); SimilarHotelsGetRes response = new SimilarHotelsGetRes(); response = masterProviders.GetSimilarHotels(request, token).Result; model.HotelName = HotelName; model.PositionId = request.PositionId; model.ProductId = request.ProductId; ViewBag.EnquiryPipeline = EnquiryPipeline; model.IsClone = request.IsClone; if (string.IsNullOrEmpty(CityName) || string.IsNullOrEmpty(CountryName)) model.HotelDesc = CityName + CountryName; else model.HotelDesc = CityName + ", " + CountryName; if (!string.IsNullOrEmpty(StarRating)) model.HotelDesc = model.HotelDesc + " - " + StarRating; if (!string.IsNullOrEmpty(BudgetCategory)) model.HotelDesc = model.HotelDesc + " - " + BudgetCategory; if (!string.IsNullOrEmpty(Location)) model.HotelDesc = model.HotelDesc + " - " + Location; if (response.ResponseStatus.Status.ToLower() == "success") { model.SelectedHotelList = response.SelectedHotelList; model.BlackListedHotelList = response.BlackListedHotelList; foreach (var hotel in model.SelectedHotelList) { hotel.VoyagerProductId = hotel.VoyagerProductId + "|" + hotel.SupplierId; hotel.Name = hotel.Name + " ("; if (!string.IsNullOrEmpty(hotel.LocationInfo.CityName)) hotel.Name = hotel.Name + hotel.LocationInfo.CityName; if (!string.IsNullOrEmpty(hotel.StarRating)) hotel.Name = hotel.Name + " ," + hotel.StarRating; if (!string.IsNullOrEmpty(hotel.Category)) hotel.Name = hotel.Name + "/" + hotel.Category; if (!string.IsNullOrEmpty(hotel.Location)) hotel.Name = hotel.Name + "/" + hotel.Location; if (!string.IsNullOrEmpty(hotel.Supplier)) hotel.Name = hotel.Name + "/" + hotel.Supplier; hotel.Name = hotel.Name + ")"; } foreach (var hotel in model.BlackListedHotelList) { hotel.VoyagerProductId = hotel.VoyagerProductId + "|" + hotel.SupplierId; hotel.Name = hotel.Name + " ("; if (!string.IsNullOrEmpty(hotel.LocationInfo.CityName)) hotel.Name = hotel.Name + hotel.LocationInfo.CityName; if (!string.IsNullOrEmpty(hotel.StarRating)) hotel.Name = hotel.Name + " ," + hotel.StarRating; if (!string.IsNullOrEmpty(hotel.Category)) hotel.Name = hotel.Name + "/" + hotel.Category; if (!string.IsNullOrEmpty(hotel.Location)) hotel.Name = hotel.Name + "/" + hotel.Location; if (!string.IsNullOrEmpty(hotel.Supplier)) hotel.Name = hotel.Name + "/" + hotel.Supplier; hotel.Name = hotel.Name + ")"; } } return PartialView("_SimilarHotels", model); }