예제 #1
0
        public ActionResult DisabledModulesList(string sortOrder, string searchString, string userSearchString)
        {
            ViewBag.NameSortParam = String.IsNullOrEmpty(sortOrder) ? "name_asc" : "";

            IEnumerable <Module> modules;

            using (Repos repo = new Repos())
            {
                modules = repo.GetModuleList();
            }

            if (!String.IsNullOrEmpty(searchString))
            {
                modules = modules.Where(m => m.Name.Contains(searchString) && m.isDisabled == true);
            }

            if (!String.IsNullOrEmpty(userSearchString))
            {
                modules = modules.Where(m => m.User.UserName.Contains(searchString) && m.isDisabled == true);
            }

            switch (sortOrder)
            {
            case "name_asc":
                modules = modules.OrderBy(m => m.Name);
                break;
            }
            return(View(modules));
        }