コード例 #1
0
ファイル: LDAPController.cs プロジェクト: patrickwensel/WS
        public object GetAllCountries()
        {
            logger.Debug("Start");
            List <Country> countries = new List <Country>();

            try
            {
                countries = _ldapService.GetAllCountries();
            }
            catch (Exception e)
            {
                logger.ErrorException("Exception", e);
            }

            return(countries);
        }
コード例 #2
0
        public void PopulateCountries()
        {
            IEnumerable <CountryViewModel> countries = AutoMapper.Mapper.Map <IEnumerable <CountryViewModel> >(_ldapService.GetAllCountries());

            List <SelectListItem> countriesList = countries.Select(countryViewModel => new SelectListItem {
                Value = countryViewModel.Code, Text = countryViewModel.Name
            }).OrderBy(t => t.Text).ToList();

            SelectList countriesSelectList = new SelectList(countriesList, "value", "text");

            ViewData["countries"] = countriesSelectList;
        }