Exemple #1
0
        public static bool InsertIntoDB(List <SongItem> hits)
        {
            try
            {
                HudbaEntities entities = new HudbaEntities();
                foreach (SongItem hit in hits)
                {
                    Song song = new Song();
                    song.Artist = hit.artist;
                    song.Id     = hit.id;
                    song.Lyrics = hit.lyrics;
                    song.Title  = hit.title;

                    entities.Songs.Add(song);;
                }

                entities.SaveChanges();

                return(true);
            }
            catch
            {
                return(false);
            }
        }
Exemple #2
0
        public static bool DeleteDBtable()
        {
            HudbaEntities entities = new HudbaEntities();

            entities.Database.ExecuteSqlCommand("Delete FROM Songs");

            entities.SaveChanges();

            return(true);
        }