public ActionResult Index(ListViewModel model) { //model.Contacts = _contactBUS.GetContacts().Where(c => c.Prefix == model.Prefix).ToList(); var data = _contactBUS.GetContacts().Where(c => c.Prefix == model.Prefix); if(model.Ascending) model.Contacts = data.OrderBy(c => c.LastName).ToList(); else model.Contacts = data.OrderByDescending(c => c.LastName).ToList(); model.PrefixCount = _contactBUS.GetContacts().GroupBy(c => c.Prefix).ToDictionary(gr=>gr.Key, gr=>gr.Count()); return View(model); }
public ActionResult Index(ListViewModel model) { model.Contacts = _contactBUS.GetContacts().Where(c => c.Prefix == model.Prefix).ToList(); model.PrefixCount = _contactBUS.GetContacts().GroupBy(c => c.Prefix).ToDictionary(gr => gr.Key, gr => gr.Count()); return View(model); }
public ActionResult Index(ListViewModel model) { return View(model); }