void Button_Clicked(object sender, System.EventArgs e) { Food elementalFood = new ElementalFood(ingredientEntry.Text); using (SQLiteConnection conn = new SQLiteConnection(App.FilePath)) { conn.CreateTable <ElementalFood>(); int rowsAdded = conn.Insert(elementalFood); } }
private void AddNewElementalFood(string name) { foreach (ElementalFood e in elementalFoods) { if (e.Name == name) { throw new ElementAlreadyExistException("elemental food with name \"" + name + "\" already exist"); } } ElementalFood food = new ElementalFood(name); elementalFoods.Add(food); }