Example #1
0
 public static ExtendedSearch ExtendedSearch(ExtendedSearch search, out int? max, Culture culture)
 {
     max = 0;
     if (search == null)
         return new ExtendedSearch(culture);
     if (!search.NeedToSearch)
         return search;
     int? type = search.CurrentPlaceType;
     if (type == -1)
         type = null;
     switch (search.CurrentSearchItem)
     {
         case (int)SearchItem.Region:
             Country country;
             search.Regions = DataManager.Regions.GetRegions(null, search.Page, ItemsPerPage, out max, out country, culture, search.Name, SearchOrder.GetOrder(search.CurrentSearchOrder));
             return search;
         case (int)SearchItem.Place:
             Region region;
             search.Places = DataManager.Places.GetPlaces(null, search.Page, ItemsPerPage, out max, out region, culture, search.Name, type, SearchOrder.GetOrder(search.CurrentSearchOrder));
             return search;
         case (int)SearchItem.Route:
             search.Routes = DataManager.Routes.GetPublicRoutes(search.Page, ItemsPerPage, out max, culture, search.Name, SearchOrder.GetOrder(search.CurrentSearchOrder));
             return search;
         default:
             search.Countries = DataManager.Countries.GetCountries(search.Page, ItemsPerPage, out max, culture, search.Name, SearchOrder.GetOrder(search.CurrentSearchOrder));
             return search;
     }
 }
 public ActionResult Extended(ExtendedSearch search)
 {
     User user = DefineUser(HttpContext);
     if (user == null)
         return RedirectToAction("LogIn", "User");
     ViewBag.User = user;
     Culture culture = DefineLanguage(HttpContext);
     ViewBag.Culture = culture;
     int? max;
     search = Manager.ExtendedSearch(search, out max, culture);
     ViewBag.Max = max;
     return View(search);
 }