Example #1
0
        public IActionResult Availability()
        {
            IEnumerable <Branch>   branches = _branchDataService.GetAll();
            IEnumerable <Category> catList  = _categoryDataService.GetAll();

            ProductAvailabilityViewModel vm = new ProductAvailabilityViewModel
            {
                Categories = catList,
                Branches   = branches
            };

            return(View(vm));
        }
Example #2
0
        public ProductAvailabilityViewModel GetProductAvailability(ProductAvailabilityInputModel inputModel)
        {
            _viewModel = new ProductAvailabilityViewModel(true, "StandAndAreaSelection.ascx");
            Mapper.CreateMap <ProductAvailabilityInputModel, DEProductDetails>();
            ErrorObj  err = new ErrorObj();
            DataTable dtStadiumAvailability  = new DataTable();
            DataTable dtAvailablePriceBreaks = new DataTable();
            DataTable dtPriceBreakPrices     = new DataTable();
            DataTable dtProductPriceBands    = new DataTable();

            _rovingAreaPrefix        = "*";
            _rovingAreaText          = _viewModel.GetControlText("RovingAreaText");
            _rovingAreaPrefixAndText = _rovingAreaPrefix + _rovingAreaText;
            if (inputModel.StandCode != null)
            {
                if (inputModel.StandCode.Contains(_rovingAreaPrefixAndText))
                {
                    inputModel.StandCode = inputModel.StandCode.Substring(0, inputModel.StandCode.IndexOf(_rovingAreaPrefix));
                }
            }
            _deProdDetails = Mapper.Map <DEProductDetails>(inputModel);

            dtStadiumAvailability = getStadiumAvailability(err);
            if (!_viewModel.Error.HasError)
            {
                dtAvailablePriceBreaks = getAvailablePriceBreaks(err);
                if (!_viewModel.Error.HasError)
                {
                    dtPriceBreakPrices = getPriceBreakPrices(err, inputModel.PriceBreakId);
                    if (!_viewModel.Error.HasError)
                    {
                        dtProductPriceBands = getProductPriceBands(err);
                        if (!_viewModel.Error.HasError)
                        {
                            buildViewModel(dtStadiumAvailability, dtAvailablePriceBreaks, dtPriceBreakPrices, dtProductPriceBands, inputModel.PriceBreakId, inputModel.DefaultPriceBand, inputModel.StandCode, inputModel.AreaCode);
                        }
                    }
                }
            }
            return(_viewModel);
        }