public ActionResult Category(int id = 2) { context = new BlondsCookingContext(); IEnumerable<Recipe> model = context.Query<Recipe>().Where(recipe => recipe.CategoryId == id); if (context.Query<Category>().FirstOrDefault(category => category.Id == id) == null) { return View("Error"); } return View(model); }
public HomeController(IBlondsCookingContext context) { this.context = context; }
public HomeController() { this.context = new BlondsCookingContext(); }