Пример #1
0
        //
        // GET: /Search/Details/5
        //public ActionResult Details(int id)
        public ActionResult Details(IdentitySearchQueryOptions queryOptions)
        {
            IEnumerable<People> people;

            //Console.SetOut(new DebugTextWriter());
            if (queryOptions == null)
            {
                return RedirectToAction("Index");
            }

            using (var conn = _dbService.GetConnection())
            {
                people = conn.Query<People>("EXEC usp_IAMSearch @SearchString = @searchString, " +
                                             "@SearchMethod = @searchMethod, " +
                                             "@NumItemsPerPage = @numItemsPerPage, " +
                                             "@PageNumber = @pageNumber",
                    new
                    {
                        searchString = (string)queryOptions.SearchString,
                        searchMethod = (string)(String.IsNullOrEmpty(queryOptions.SearchMethod) ? "Search" : queryOptions.SearchMethod),
                        numItemsPerPage = (int)(queryOptions.NumItemsPerPage == 0 ? 5 : queryOptions.NumItemsPerPage),
                        pageNumber = (int)(queryOptions.PageNumber == 0 ? 1 : queryOptions.PageNumber)
                    }
                    ).AsQueryable();
            }

            if (!people.Any())
            {
                return RedirectToAction("Index");
            }

            return View(people);
        }
Пример #2
0
 //
 // GET: /Search/
 public ActionResult Index()
 {
     var model = new IdentitySearchQueryOptions();
     return View(model);
 }