Exemplo n.º 1
0
        // GET: Settings/Regions
        public ActionResult Index(SearchRegionViewModel model)
        {
            GetCountries();
            if (model.CountryId == 0)
            {
                model.CountryId = ViewBag.Countries[0].CountryId;
            }

            var result = _placesService.GetRegions(model);

            model.Items = new StaticPagedList <RegionViewModel>(result.Items
                                                                , model.PageIndex + 1, model.PageSize, result.TotalCount);
            return(View(model));
        }
Exemplo n.º 2
0
        public void GetRegions_WithValidParamters_ReturunTotalCountAndItemsIfFound(string regionName, string regionCode
                                                                                   , int expectedItemsCount, int expectedTotalItemsCount)
        {
            SearchRegionViewModel searchRegionViewModel = new SearchRegionViewModel(3)
            {
                RegionName = regionName,
                CountryId  = PlaceServiceTestCases.Country.CountryId,
                RegionCode = regionCode,
                PageIndex  = 0,
            };

            var result = _placesServices.GetRegions(searchRegionViewModel);

            result.Items.Count.Should().Be(expectedItemsCount);
            result.TotalCount.Should().Be(expectedTotalItemsCount);
        }