private IEnumerable <MvcCategory> GetAllOrFind(string searchString) { IEnumerable <BLLCategory> allCategories = categories.GetAll(); List <MvcCategory> mvcCategories = allCategories.Select(c => CategoryMapper.GetMVCEntity(c)).ToList(); if (!ReferenceEquals(searchString, null) && searchString != "") { mvcCategories = mvcCategories.Where(s => s.Name.Contains(searchString)).ToList(); } return(mvcCategories); }
public ActionResult EditCategory(int id) { MvcCategory category = CategoryMapper.GetMVCEntity(categories.Get(id)); return(View(category)); }