Exemple #1
0
        public bool SaveGame(List <Game> Games)
        {
            bool result = false;

            try
            {
                using (ScambiContext db = ScambiContext.CreateContext())
                {
                    Games.ForEach(game =>
                    {
                        // Se non era già stato importato il gioco allora lo inserisco
                        if (db.Games.Select(g => g.IdImport == game.IdImport).Count() == 0)
                        {
                            db.Games.Add(game);
                            db.SaveChanges();
                        }
                    });
                }
                result = true;
            }
            catch (Exception ex)
            {
            }
            return(result);
        }
Exemple #2
0
        public List <Genre> GetGenres()
        {
            List <Genre> Genres = new List <Genre>();

            try
            {
                using (ScambiContext db = ScambiContext.CreateContext())
                {
                    Genres = db.Genres.ToList();
                }
            }
            catch (Exception ex)
            {
                Utitlity.LogError.AddError(ex);
            }
            return(Genres);
        }
Exemple #3
0
        public List <Platform> GetPlatforms()
        {
            List <Platform> Platforms = new List <Platform>();

            try
            {
                using (ScambiContext db = ScambiContext.CreateContext())
                {
                    Platforms = db.Platforms.ToList();
                }
            }
            catch (Exception ex)
            {
                Utitlity.LogError.AddError(ex);
            }
            return(Platforms);
        }