public IActionResult Index() { var countries = _repository.All(); var model = new CountryViewModel(countries); return(View(model)); }
public CountryListViewModel GetCountryListViewModel() { var all = _countryRepository.All().ToList(); var model = new CountryListViewModel { Countries = all, Header = new HeaderViewModel(all.Count()) }; return(model); }
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); }
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)); }
public ActionResult Index() { return(this.Jsonp(CountryRepository.All())); }