using System.Collections.Generic;
namespace RequesIEnumerable
public class CategoryController : Controller
public ActionResult Index()
List<CategoryViewModel> categories = new List<CategoryViewModel>();
categories.Add(new CategoryViewModel { CategoryId = 1, CategoryName = "CategoryOne" });
categories.Add(new CategoryViewModel { CategoryId = 2, CategoryName = "CategoryTwo" });
categories.Add(new CategoryViewModel { CategoryId = 3, CategoryName = "CategoryThree" });
categories.Add(new CategoryViewModel { CategoryId = 4, CategoryName = "CategoryFour" });
IEnumerable<CategoryViewModel> ieCategories = categories;
return View(ieCategories);
public ActionResult Index(IEnumerable<CategoryViewModel> model)
var count = Request.Form.ToString().Split('&').Length;
return RedirectToAction("Index");