Ejemplo n.º 1
0
        public IActionResult Index()
        {
            var countries = _repository.All();
            var model     = new CountryViewModel(countries);

            return(View(model));
        }
Ejemplo n.º 2
0
        public CountryListViewModel GetCountryListViewModel()
        {
            var all   = _countryRepository.All().ToList();
            var model = new CountryListViewModel
            {
                Countries = all,
                Header    = new HeaderViewModel(all.Count())
            };

            return(model);
        }
Ejemplo n.º 3
0
        public void Test_Add()
        {
            var position    = _fixture.Create <int>();
            var russianName = _fixture.Create <string>();
            var englishName = _fixture.Create <string>();

            var id = _country.Add(englishName, russianName, position);

            var russian = _country.All(TwoLetterISOLanguageName.Russian).First(x => x.Id == id);

            var english = _country.All(TwoLetterISOLanguageName.English).First(x => x.Id == id);

            russian.ShouldBeEquivalentTo(english, options => options.Excluding(x => x.Name));
            russian.Name.ShouldBeEquivalentTo(russianName);
            english.Name.ShouldBeEquivalentTo(englishName);
        }
Ejemplo n.º 4
0
        public SlicedList <Country> GetSliceOf(int pageIndex, string filterToApply = "")
        {
            string FilterSource(Country country) => string
            .Format("{0} {1}", country.CountryName, country.ContinentName);

            _countryPaginator = new Paginator <Country>(_countryRepository.All().ToList(), filterToApply);
            _countryPaginator.InstallFilterSource(FilterSource);

            return(_countryPaginator.Take(pageIndex));
        }
Ejemplo n.º 5
0
 public ActionResult Index()
 {
     return(this.Jsonp(CountryRepository.All()));
 }