コード例 #1
0
        public List <PopulerSearchesViewModel> PopulerSearchesCity()
        {
            DataTable dt = _homeRepositories.PopulerSearchesCity();
            List <PopulerSearchesViewModel> lstCity = new List <PopulerSearchesViewModel>();

            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    PopulerSearchesViewModel city = new PopulerSearchesViewModel
                    {
                        CityCode   = Convert.ToString(dt.Rows[i]["CityCode"]),
                        City       = Convert.ToString(dt.Rows[i]["City"]),
                        TotalCount = Convert.ToString(dt.Rows[i]["Count"]),
                    };
                    lstCity.Add(city);
                }
            }
            return(lstCity);
        }