// GET: MessageSends public async Task <IActionResult> Index() { var countryMessages = new List <CountryMessages>(); var countries = await _repository.GetCountries(); foreach (var country in countries) { var c = new CountryMessages { CountryId = country.Id, CountryName = country.Name, MesagesSentCount = await _repository.CountMessagesSentsToCountry(country.Id) }; countryMessages.Add(c); } return(View(countryMessages)); }