Example #1
0
        public ActionResult GetAlbums()
        {
            using (StreamReader sr = new StreamReader(@".\Album_Review_pitchfork_final.txt"))
            {
                String line = sr.ReadToEnd().Replace(System.Environment.NewLine, "");

                string[] rows = line.Split(';');

                for (int i = 0; i < rows.Length - 1; i++)
                {
                    string[] columns = rows[i].Split('#');
                    db.Albums.Add(new Album()
                    {
                        Genere = columns[0],
                        Artist = columns[1],
                        Title  = columns[2]
                    });
                }
            }
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }