// GET: Admin/Menu public ActionResult Index(string searchString = null) { List <MenuViewModel> model = new List <MenuViewModel>(); List <Menu> menus; if (string.IsNullOrEmpty(searchString)) { menus = menuDAO.GetAllWithTypeAndUser(); } else { menus = menuDAO.Search(searchString); } foreach (var item in menus) { model.Add(Mapper.Map <MenuViewModel>(item)); } return(View(model)); }