public CountryViewModel CreateViewModel(List <Country> countries) { CountryViewModel flags = new CountryViewModel(); flags.Countries = countries; flags.CountriesCount = countries.Count; flags.EuropeanCountriesCount = _countryService.GetContinentCount("Europe", countries); flags.AsianCountriesCount = _countryService.GetContinentCount("Asia", countries); flags.AfricanCountriesCount = _countryService.GetContinentCount("Africa", countries); flags.SAmericanCountriesCount = _countryService.GetContinentCount("South America", countries); flags.NAmericanCountriesCount = _countryService.GetContinentCount("North America", countries); flags.AustralianCountriesCount = _countryService.GetContinentCount("Australia", countries); flags.CountriesArea = _countryService.GetCountriesArea(countries).ToString("N0"); flags.CountriesPercent = _countryService.CountCountriesPercent(flags.CountriesCount); flags.CountriesAreaPercent = _countryService.CountCountriesAreaPercent(_countryService.GetCountriesArea(countries)); flags.ShareLink = "?id=" + _shareService.GenerateGuid(); return(flags); }