Exemplo n.º 1
0
 public static void Initialize(this ITownDefViewModel viewModel, IEnumerable<Town> towns)
 {
     QueryNamesService service = new QueryDistinctCityNamesService(towns);
     viewModel.CityList = service.Query().ToList().Select(
             x => new SelectListItem { Value = x, Text = x }).ToList();
     viewModel.DistrictList = new List<SelectListItem>();
     viewModel.TownList = new List<SelectListItem>();
 }
Exemplo n.º 2
0
 public static void Initialize(this ITownDefViewModel viewModel, IEnumerable<Town> towns, ITown town)
 {
     QueryNamesService service = new QueryDistinctCityNamesService(towns);
     viewModel.CityList
             = service.Query().ToList().Select(
             x => new SelectListItem { Value = x, Text = x, Selected = x == town.CityName }).ToList();
     service = new QueryDistinctDistrictNamesService(towns, town.CityName);
     viewModel.DistrictList
         = service.Query().ToList().Select(
             x => new SelectListItem { Value = x, Text = x, Selected = x == town.DistrictName }).ToList();
     service = new QueryDistinctTownNamesService(towns, town.CityName, town.DistrictName);
     viewModel.TownList
         = service.Query().ToList().Select(
             x => new SelectListItem { Value = x, Text = x, Selected = x == town.TownName }).ToList();
 }
Exemplo n.º 3
0
 public IEnumerable<string> GetCityList()
 {
     QueryNamesService service = new QueryDistinctCityNamesService(townRepository.GetAll());
     return service.Query().ToList();
 }