public List<CountryViewModel> GetCountryDetails() { DataTable country = masterDataRepository.GetCountries(); List<CountryViewModel> lstCountry = new List<CountryViewModel>(); if (country.Rows.Count > 0) { lstCountry = ConvertDatatableToModelList.ConvertDataTable<CountryViewModel>(country); } return lstCountry; }
public IEnumerable <CountryViewModel> GetCountries() { IList <CountryViewModel> countries = null; var dTable = masterDataRepository.GetCountries(); if (null != dTable && dTable.Rows.Count > 0) { countries = new List <CountryViewModel>(); foreach (DataRow row in dTable.Rows) { countries.Add(new CountryViewModel { CountryCode = Convert.ToString(row["CountryCode"]), Country = Convert.ToString(row["Country"]) }); } } return(countries); }