public class CategoryController : Controller { // // GET: /Category/ ProductsDbEntities ctx; public CategoryController ( ) { ctx = new ProductsDbEntities( ); } public ActionResult Index ( ) { try { var categoryList = ctx.Categories.ToList( ); return View( categoryList ); } catch ( Exception ex ) { throw ex; } } }
@model MvcSession.Models.CategoryDetails @{ ViewBag.Title = "SearchProducts"; } @using (Html.BeginForm()) { @Html.EditorFor(cat => cat.CategoryId); <div class="form-group"> <div class="col-md-offset-2 col-md-10"> <input type="submit" value="Search" class="btn btn-default" /> </div> </div> }
list of Categories
CategoryDetails
@model MvcSession.Models.CategoryDetails
categoryList
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)