コード例 #1
0
        public async Task <SimilarHotelsGetRes> GetSimilarHotels([FromBody] SimilarHotelsGetReq request)
        {
            var response = new SimilarHotelsGetRes();

            try
            {
                if (request != null)
                {
                    response = await _productRepository.GetSimilarHotels(request);

                    if (response.SelectedHotelList.Count > 0 || response.BlackListedHotelList.Count > 0)
                    {
                        response.ResponseStatus.Status = "Success";
                    }
                    else
                    {
                        response.ResponseStatus.Status       = "Success";
                        response.ResponseStatus.ErrorMessage = "No Records Found.";
                    }
                }
                else
                {
                    response.ResponseStatus.Status       = "Failure";
                    response.ResponseStatus.ErrorMessage = "Request details can not be blank.";
                }
            }
            catch (Exception ex)
            {
                response.ResponseStatus.Status       = "Failure";
                response.ResponseStatus.ErrorMessage = "An error occurs " + ex.Message;
            }
            return(response);
        }
コード例 #2
0
ファイル: MasterProviders.cs プロジェクト: dilip07156/CoreUI
        public async Task <SimilarHotelsGetRes> GetSimilarHotels(SimilarHotelsGetReq similarHotelsGetReq, string ticket)
        {
            SimilarHotelsGetRes similarHotelsGetRes = new SimilarHotelsGetRes();

            similarHotelsGetRes = await serviceProxy.PostData(_configuration.GetValue <string>("ServiceMaster:GetSimilarHotels"), similarHotelsGetReq, typeof(SimilarHotelsGetRes), ticket);

            return(similarHotelsGetRes);
        }
コード例 #3
0
        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);
        }