public void AddPedestrian(PedestrianDTO pedestrianDTO) { PedestrianModel pedestrian = new PedestrianModel(this, pedestrianDTO); pedestrian.SaveDb(); _pedestrians.ModifyCollection(col => col.Add(pedestrian)); }
public void LoadDb() { PedestriansInfo[] cities; using (DatabaseModel dbContext = new DatabaseModel()) { dbContext.Set <PedestriansInfo>().Load(); cities = dbContext.Set <PedestriansInfo>().ToArray(); } _pedestrians.ModifyCollection(col => { col.Clear(); foreach (PedestriansInfo pedestrianDA in cities) { PedestrianModel pedestrian = new PedestrianModel(this, pedestrianDA); pedestrian.LoadDb(); col.Add(pedestrian); } }); }