Example #1
0
        /// <summary>
        /// Apagar todo o banco
        /// </summary>
        private static void DeleteChanges()
        {
            WebCrawlerContext wcc = new WebCrawlerContext();

            wcc.StartConnection();

            wcc.Database.ExecuteSqlCommand("TRUNCATE TABLE [WebCrawlerDB].[dbo].[GameNews]");
        }
Example #2
0
        /// <summary>
        /// Salvar dados no banco
        /// </summary>
        /// <param name="gameNews"></param>
        private static void DataSaveChanges(List <GameNews> gameNews)
        {
            WebCrawlerContext wcc = new WebCrawlerContext();

            wcc.StartConnection();

            if (gameNews != null)
            {
                foreach (var gn in gameNews)
                {
                    wcc.GameNews.Add(gn);
                    wcc.SaveChanges();
                }
            }
        }