// Add a place to the database and collections. public void AddPlace(PlaceDetails newPlace) { // Add a place to the data context. placeDB.Places.InsertOnSubmit(newPlace); // Save changes to the database. SaveChangesToDB(); // Add a place to the "all" observable collection. AllPlaces.Add(newPlace); }
public async Task OnGet() { (await _placeService.GetAllPlacesSelectAsync()).ToList().ForEach(x => { AllPlaces.Add(new SelectListItem() { Value = x.Id.ToString(), Text = x.Title }); }); (await _subjectService.GetSubjectSelects()).ToList().ForEach(x => { AllSubject.Add(new SelectListItem() { Value = x.Id.ToString(), Text = x.Title }); }); }
public PlacesViewModel() { Places = new ObservableCollection <Place>(); //seeding some data for test purpose for (int i = 0; i < 40; i++) { AllPlaces.Add(new Place() { Name = "l4", Building = "e3dady", Floor = "first", Description = "Don't go there" }); AllPlaces.Add(new Place() { Name = "k6", Building = "khraba", Floor = "second", Description = "Don't go there, also" }); } PreformFiltering(); }