public override IQueryable <SaveAuction> AddQuery(IQueryable <SaveAuction> query, FilterArgs args) { if (!args.Filters.ContainsKey("Enchantment")) { throw new CoflnetException("invalid_filter", "You need to select an enchantment and a lvl to filter for"); } var enchant = Enum.Parse <Enchantment.EnchantmentType>(args.Filters["Enchantment"]); var lvl = (short)args.GetAsLong(this); var itemid = int.Parse(args.Filters["ItemId"]); Console.WriteLine(itemid); return(query.Where(a => a.Enchantments.Where(e => itemid == e.ItemType && e.Type == enchant && e.Level == lvl).Any())); }
public override IQueryable <SaveAuction> AddQuery(IQueryable <SaveAuction> query, FilterArgs args) { var level = args.GetAsLong(this); return(query.Where(a => EF.Functions.Like(a.ItemName, $"[Lvl {level}]%"))); }