Пример #1
0
        public IActionResult Search()
        {
            string          propertySearch = HttpContext.Request.Query["propertysearch"].ToString().Trim().ToLower();
            string          textsearch     = HttpContext.Request.Query["textsearch"].ToString().Trim().ToLower();
            string          strPage        = HttpContext.Request.Query["page"].ToString();
            int             page           = Convert.ToInt32(strPage == "" ? "1" : strPage);
            List <UserView> listUser       = new List <UserView>();

            switch (propertySearch)
            {
            case "email":
                listUser     = UserBus.SearchByEmail(page, textsearch);
                ViewBag.Rows = UserBus.GetRowCountSearchByEmail(textsearch);
                break;

            case "name":
                listUser     = UserBus.SearchByName(page, textsearch);
                ViewBag.Rows = UserBus.GetRowCountSearchByName(textsearch);
                break;

            case "phone":
                listUser     = UserBus.SearchByPhone(page, textsearch);
                ViewBag.Rows = UserBus.GetRowCountSearchByPhone(textsearch);
                break;

            case "address":
                listUser     = UserBus.SearchByAddress(page, textsearch);
                ViewBag.Rows = UserBus.GetRowCountSearchByAddress(textsearch);
                break;

            default:
                listUser     = UserBus.SearchAll(page, textsearch);
                ViewBag.Rows = UserBus.GetRowCountSearchAll(textsearch);
                break;
            }
            return(View("index", listUser));
        }