/// <summary> /// Updates a partial view of selected recipes /// </summary> /// <param name="subcatid">SubCategory id</param> /// <returns>Partial view</returns> public ActionResult UpdateSelected(int subcatid) { List<Recipe> recipes = repository.GetRecipesBySubCategoryId(subcatid); RecipeListViewModel viewModel = new RecipeListViewModel(null, recipes, null, null, 1, 1); return PartialView("_SelectedRecipes", viewModel); }
public ViewResult Index() { var recipes = repository.GetAllRecipesWithSubCategory().OrderBy(r => r.SubCategory.SubCategoryID); var recipesList = repository.GetRecipesBySubCategoryId(1); var categories = repository.GetAllCategories(); var subcategories = repository.GetSubCategoriesByCategoryId(1); RecipeListViewModel viewModel = new RecipeListViewModel(recipes.ToList(), recipesList, categories, subcategories, 1, 1); return View(viewModel); }