public object BuildViewQuery() { return(new { filter = new[] { FilterQueries.Select(x => x.Build()).JoinNotEmpty(", ") }, order = SortQueries, row_number = RowNumber, row_count = RowCount, }); }
// GET: Filter public ActionResult Index() { ViewBag.Genres = new SelectList(db.Genre, "ID", "Name"); ViewBag.Types = new SelectList(db.Type, "ID", "Name"); var filter = new FilterViewModel(); filter.MinDuration = FilterQueries.GetMinDuration(); filter.MaxDuration = FilterQueries.GetMaxDuration(); filter.MinPlayers = FilterQueries.GetMinPlayers(); filter.MaxPlayers = FilterQueries.GetMaxPlayers(); filter.MaxPrice = FilterQueries.GetMaxPrice(); filter.MinPrice = FilterQueries.GetMinPrice(); filter.MaxDifficulty = 5; filter.MinDifficulty = 1; return(PartialView(filter)); }
public ActionResult GamesCatalog(FormCollection formcollection) { var type = formcollection["Type"] == String.Empty ? null : db.Type.Find(int.Parse(formcollection["Type"])).Name; var genre = formcollection["Genre"] == String.Empty ? null : db.Genre.Find(int.Parse(formcollection["Genre"])).Name; var price = formcollection["price"]; var minPrice = double.Parse(price.Substring(0, price.IndexOf('₽'))) - 1; var maxPrice = double.Parse(price.Substring(price.LastIndexOf(' ') + 1, price.LastIndexOf('₽') - price.LastIndexOf(' ') - 1)) + 1; var difficulty = formcollection["diffiulty"]; var minDifficulty = int.Parse(difficulty.Substring(0, difficulty.IndexOf(' '))); var maxDifficulty = int.Parse(difficulty.Substring(difficulty.LastIndexOf(' ') + 1)); var players = formcollection["players"]; var minPlayers = int.Parse(players.Substring(0, players.IndexOf(' '))); var maxPlayers = int.Parse(players.Substring(players.LastIndexOf(' ') + 1)); var duration = formcollection["duration"]; var minDuration = int.Parse(duration.Substring(0, duration.IndexOf(' '))); var maxDuration = int.Parse(duration.Substring(duration.LastIndexOf(' ') + 1)); var startswith = formcollection["startswith"]; var games = FilterQueries.GetGamesParamsWithFilter(db, startswith, minPrice, maxPrice, minDuration, maxDuration, minDifficulty, maxDifficulty, minPlayers, maxPlayers, genre, type); return(PartialView(games)); }
public DataVaultQueryBuilder Filter(PredicateBuilder filter) { FilterQueries.Add(filter); return(this); }