예제 #1
0
        public JsonResult WinBoostPricing(PurchaseForm Model)
        {
            decimal price;
            string  premiumOrRegular = Model.WinBoostModel.TypeOfDuoPremium != "false" ? "Premium" : "Regular";
            string  lastSeason       = Model.WinBoostModel.TypeOfService == "Duo" ? $"{Model.WinBoostModel.YourCurrentLeague} {Model.WinBoostModel.CurrentDivision} ({Model.WinBoostModel.TypeOfService}) ({premiumOrRegular})"
                        : $"{Model.WinBoostModel.YourCurrentLeague} {Model.WinBoostModel.CurrentDivision} ({Model.WinBoostModel.TypeOfService})";

            if (Model.WinBoostModel.YourCurrentLeague == "Master" || Model.WinBoostModel.YourCurrentLeague == "Grandmaster" || Model.WinBoostModel.YourCurrentLeague == "Challenger")
            {
                lastSeason = Model.WinBoostModel.TypeOfService == "Duo" ? $"{Model.WinBoostModel.YourCurrentLeague} ({Model.WinBoostModel.TypeOfService}) ({premiumOrRegular})"
                                : $"{Model.WinBoostModel.YourCurrentLeague} ({Model.WinBoostModel.TypeOfService})";
            }

            WinBoostPricing result = ObjectFactory.WinBoostPricing.Where(x => x.LastSeasonStanding == lastSeason && x.NumberOfGames == Model.WinBoostModel.NumOfGames).FirstOrDefault();

            if (result == null)
            {
                return(Json(1.50));
            }
            else
            {
                price = (System.Math.Ceiling(decimal.Parse(result.OurPrice) * 100) / 100);

                price = LolPricingExtensions.PriceIncreaseLolNA(Model.WinBoostModel.Server, price, 40);
                var priceDiscountResult = LolDiscountExtensions.PriceDiscount(Model.WinBoostModel.Discount, price);
                price = priceDiscountResult.Price;
                return(Json(new { success = true, Price = price, Discount = priceDiscountResult.DicountPercentage, DiscountModel = priceDiscountResult.Discount }));
            }
        }
예제 #2
0
        public JsonResult TFTPlacementBoostPricing(PurchaseForm Model)
        {
            WinBoostPricing result = ObjectFactory.TFTPlacementBoostPricing.Where(x => x.LastSeasonStanding == Model.TFTPlacementModel.LastSeasonStanding && x.NumberOfGames == Model.TFTPlacementModel.NumberOfGames).FirstOrDefault();

            if (result == null)
            {
                return(Json(0));
            }
            else
            {
                decimal price = (System.Math.Ceiling(decimal.Parse(result.OurPrice) * 100) / 100);
                var     priceDiscountResult = LolDiscountExtensions.PriceDiscount(Model.TFTPlacementModel.DiscountCode, price);
                price = priceDiscountResult.Price;
                return(Json(new { success = true, Price = price, Discount = priceDiscountResult.DicountPercentage, DiscountModel = priceDiscountResult.Discount }));
            }
        }