예제 #1
0
        public static Videogames GetGame(int id)
        {
            Videogames producto = null;

            try
            {
                GameContext context = new GameContext();
                producto = context.Videogames.Where(x => x.id == id).SingleOrDefault();
            }
            catch (Exception e)
            {
                throw;
            }
            return(producto);
        }
예제 #2
0
        public static Videogames GameContainString(string search)
        {
            Videogames game = null;

            try
            {
                GameContext context = new GameContext();
                search = search.ToLower();
                string[] palabrasBuscar = search.Split(' ');
                foreach (string palabra in palabrasBuscar)
                {
                    game = context.Videogames.Where(x => x.name.ToLower().Contains(palabra)).SingleOrDefault();
                }
            }
            catch (Exception e)
            {
            }
            return(game);
        }