public JsonResult GetLaguagePricingById(int laguagePricingId)
        {
            _serviceEndPoint = new ServicesEndPoint.GeneralSevices.ServicesEndPoint(_simbaToursUnitOfWork, _emailService);
            var result = _serviceEndPoint.GetLaguagePricing().FirstOrDefault(p => p.LaguagePricingId == laguagePricingId);

            return(Json(result));
        }
Esempio n. 2
0
        public JsonResult GetLaguagePricing()
        {
            _serviceEndPoint = new ServicesEndPoint.GeneralSevices.ServicesEndPoint(_simbaToursUnitOfWork, _emailService);

            LaguagePricing[] deals = _serviceEndPoint.GetLaguagePricing();

            return(Json(deals));
        }
Esempio n. 3
0
        public IActionResult BookTour([FromBody] TourClientViewModel tourClientModel)
        {
            try
            {
                _serviceEndPoint = new ServicesEndPoint.GeneralSevices.ServicesEndPoint(_simbaToursUnitOfWork, _emailService);
                var tourClient = AutoMapper.Mapper.Map <TourClientViewModel, TourClient>(tourClientModel);

                List <Item>             mealItems    = new List <Item>();
                List <Item>             laguageItems = new List <Item>();
                List <VehicleViewModel> vehicles     = new List <VehicleViewModel>();

                var     unitPayment      = _serviceEndPoint.GetLaguagePricing()[0];
                var     unitPaymentMeal  = _serviceEndPoint.GetMealPricing()[0];
                var     vehiclePayment   = _serviceEndPoint.GetTransportPricing()[0];
                decimal runningCostItems = 0.00M;

                IterateThroughMeals(mealItems, ref runningCostItems, unitPaymentMeal, tourClientModel, tourClient);
                IterateThroughLaguageAssortments(laguageItems, mealItems, ref runningCostItems, unitPaymentMeal, unitPayment, tourClientModel, tourClient);
                IterateThroughVehicles(tourClientModel, vehiclePayment, ref runningCostItems);

                tourClient.GrossTotalCosts += runningCostItems;
                _serviceEndPoint            = new ServicesEndPoint.GeneralSevices.ServicesEndPoint(_simbaToursUnitOfWork, _emailService);
                tourClient.DateCreated      = DateTime.Now;
                tourClient.DateUpdated      = DateTime.Now;

                tourClient.HasFullyPaid = false;

                var isBooked = _serviceEndPoint.BookSafariPackage(tourClient, mealItems.ToArray(), laguageItems.ToArray());
                if (isBooked)
                {
                    var tourClientFullView = _serviceEndPoint.GetTourClientById(tourClient.TourClientId);
                    var payPalRedirectUrl  = ValidatePayment(tourClientFullView, tourClient.CurrentPayment);
                    payPalRedirectUrl += "&clientId=" + tourClient.TourClientId;
                    return(Json(new { Result = isBooked, PayPalRedirectUrl = payPalRedirectUrl, }));
                    //return Redirect(payPalRedirectUrl);
                }
                else
                {
                    return(Json(new { Result = false, Message = "Failed To Book Tour. Please contact the administrators of the site!" }));
                }
            }
            catch (Exception e)
            {
                return(Json(new { Result = false, Message = e.Message, StackTrace = e.StackTrace }));
            }
        }