private void LoadRecipe(Recipe recipe) { var categories = repository.GetCategories().ToList(); _categoryIndex = categories.FindIndex(c => c.Name == recipe.Category.Name) + 1; textBoxTitle.Text = recipe.Title; textBoxDesc.Text = recipe.Description; textBoxIng.Text = recipe.Ingredients; comboBoxCategory.SelectedIndex = _categoryIndex; }
public void LoadCategories() { recipeCategory = new BindingList <RecipeCategory>(repository.GetCategories().ToList()); recipeCategory.Insert(0, new RecipeCategory { Name = "" }); comboBoxCategory.DataSource = recipeCategory; comboBoxCategory.DisplayMember = "Name"; }