Ejemplo n.º 1
0
        private void AddFilter(string type, string name)
        {
            var filters = (Session["GamesFilter"] as List <GamesFilter>);

            if (filters == null)
            {
                filters = new List <GamesFilter>();
            }

            var f = filters.FirstOrDefault(x => x.Type == type && x.Name == name);

            if (f != null)
            {
                filters.Remove(f);
                Session["GamesFilter"] = filters;
                return;
            }

            var filter = new GamesFilter
            {
                Name = name,
                Type = type
            };

            if (type == "Genre")
            {
                filter.Predicate = (x => x.Genre.Name == name);
            }
            else if (type == "Developer")
            {
                filter.Predicate = (x => x.Developer.Name == name);
            }

            filters.Add(filter);

            Session["GamesFilter"] = filters;
        }
Ejemplo n.º 2
0
        public async Task <SICore.GameInfo[]> GetFilteredGamesAsync(GamesFilter filter, CancellationToken cancellationToken = default)
        {
            var games = await _connection.InvokeAsync <SI.GameServer.Contract.GameInfo[]>("GetFilteredGames", filter, cancellationToken);

            return(games.Select(ToSICoreGame).ToArray());
        }