public void GetProducts() { try { ProductDataBase productDatabase = new ProductDataBase(); var products = productDatabase.getCursos().Result; if (products != null && products.Count > 0) { Cursos = new ObservableCollection <CursoxProfe>(); foreach (var prod in products) { if (prod.id == product.id) { Cursos.Add(new CursoxProfe { num = prod.num, nombre = prod.nombre, IsVisible = false, id = prod.id }); } } } } catch (Exception ex) { } }
private async void Button_ClickedAsync_1(object sender, System.EventArgs e) { u = App.Database.getUser(p.idU); await App.Database.DeleteNoteAsync(u); try { if (p.id != 0) { var result = await DisplayAlert("Confirm", "Seguro que quieres eliminar a: " + p.nombre + "? ", "Si", "No"); if (result) { lt.DeleteProduct(p); ProductDataBase dataBase = new ProductDataBase(); var list = dataBase.getCursos().Result; foreach (var prod in list) { if (prod.id == p.id) { CursoxProfe aux = new CursoxProfe(); aux.num = prod.num; aux.nombre = prod.nombre; aux.IsVisible = prod.IsVisible; aux.id = prod.id; _ = dataBase.deleteCurso(aux); } } } } } catch (Exception ex) { } await Navigation.PushAsync(new ListProfesores()); }