private async void btn_saveProd_Click(object sender, EventArgs e) { if (editProduct == null) { return; } editProduct.Ingredients = new List <Ingredient>(); //var ingredients = new List<Ingredient>(); //Fetcha allting i formuläret. foreach (var ingredient in chbxlist_ingrs.CheckedItems) { editProduct.Ingredients.Add((Ingredient)ingredient); } //Spara i databasen await _repo.UpdateCreateProduct(editProduct); await _repo.DeleteIngredientsByProductId(editProduct); await _repo.AddNewIngredientToProductAsync(editProduct); //Refresh ProductList GetAllProductsBtn_Click(sender, e); ClearIngredientsChkbxList(); }