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; }
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; }
public static UserDTO Login(string UserName, string Password) { LibraryEntities Context = new LibraryEntities(); User UserBE = Context.Users.ToList().Where(x=>x.UserName==UserName && x.Password==Password).SingleOrDefault(); UserDTO _UserDTO = null; if (UserBE != null) { _UserDTO = new UserDTO(UserBE); } return _UserDTO; }