Exemplo n.º 1
0
        public static List<CityDTO> GetCitiesByPrifix(string Prefix)
        {
            LibraryEntities Context = new LibraryEntities();
            List<CityDTO> Cities = new List<CityDTO>();

            List<City> DBCities = Context.Cities.Where(x => x.Title.Contains(Prefix)).ToList();

            foreach (City item in DBCities)
            {
                CityDTO NewCity = new CityDTO(item);
                Cities.Add(NewCity);
            }

            return Cities;
        }
Exemplo n.º 2
0
        public static List<CityDTO> GetCities()
        {
            LibraryEntities Context = new LibraryEntities();
            List<CityDTO> Cities = new List<CityDTO>();

            List<City> DBCities = Context.Cities.ToList();

            foreach (City item in DBCities)
            {
                CityDTO NewCity = new CityDTO(item);
                Cities.Add(NewCity);
            }

            return Cities;
        }