public bool DeleteFlowerType(FlowerType type) { try { using (var connection = new SQLiteConnection(System.IO.Path.Combine(Folder, "flower_manager.db"))) { connection.Delete(type); return(true); } } catch (SQLiteException ex) { return(false); } }
private void btnAdd_Clicked(object sender, EventArgs e) { Database db = new Database(); FlowerType flowerType = new FlowerType(); flowerType.Name = txtFlowerTypeName.Text; try { db.InsertFlowerType(flowerType); DisplayAlert("Thành công", "Thêm loại hoa thành công!", "OK"); } catch (Exception ex) { DisplayAlert("Thất bại", "Thêm loại hoa thất bại!", "OK"); } }
private void lsvFlowerTypes_ItemSelected(object sender, SelectedItemChangedEventArgs e) { FlowerType flowerType = (FlowerType)e.SelectedItem; Navigation.PushAsync(new ListFlowerByTypePage(flowerType.Id)); }