Exemplo n.º 1
0
        public static List <CountryViewModel> CountryViewListFill()
        {
            List <CountryViewModel> countryViewModels = new List <CountryViewModel>();
            var List = (from C in Db.Countries select new { C.CountryName, C.CountryId }).ToList();

            foreach (var item in List)
            {
                CountryViewModel NewView = new CountryViewModel();
                NewView.CountryName = item.CountryName;
                NewView.CountryID   = item.CountryId;
                countryViewModels.Add(NewView);
            }
            return(countryViewModels);
        }
Exemplo n.º 2
0
        public static List <CountryViewModel> CountryViewListFill()
        {//ülkeleri seçenilmeleri için ülkeleri Layoutta combobax şeklinde getirmem için name ve id lerine ihtiyaxım  vardı bende viewmodel oluşturdum
            List <CountryViewModel> countryViewModels = new List <CountryViewModel>();
            var List = (from C in Db.Countries select new { C.CountryName, C.CountryId }).ToList();

            foreach (var item in List)
            {
                CountryViewModel NewView = new CountryViewModel();
                NewView.CountryName = item.CountryName;
                NewView.CountryID   = item.CountryId;
                countryViewModels.Add(NewView);
            }
            return(countryViewModels);
        }