public IEnumerable <RecentlyListened> GetSongListByUserLatest(int medlemId)
        {
            using (var conn = CreateConnection())
            {
                List <RecentlyListened> recentlylistened = new List <RecentlyListened>();
                SqlCommand cmd = new SqlCommand("getSongListByUserLatest", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add("@medlemId", SqlDbType.Int, 4).Value = medlemId;

                conn.Open();
                cmd.ExecuteNonQuery();

                using (var reader = cmd.ExecuteReader())
                {
                    int songNameIndex = reader.GetOrdinal("SongName");
                    int dateIndex     = reader.GetOrdinal("Date");
                    int lengthIndex   = reader.GetOrdinal("Length");
                    int bandNameIndex = reader.GetOrdinal("BandName");
                    int betygIndex    = reader.GetOrdinal("Betyg");
                    int songIdIndex   = reader.GetOrdinal("SongId");
                    //Date, SongName, ConstrictedRows.Length, BandName, Betyg

                    while (reader.Read())
                    {
                        RecentlyListened rl = new RecentlyListened();
                        rl.SongName = reader.GetString(songNameIndex);
                        rl.Date     = reader.GetDateTime(dateIndex);
                        rl.BandName = reader.GetString(bandNameIndex);
                        rl.Betyg    = reader.GetInt32(betygIndex);
                        rl.Length   = reader.GetInt16(lengthIndex);
                        rl.SongId   = reader.GetInt32(songIdIndex);

                        recentlylistened.Add(rl);

                        /*recentlylistened.Add(new RecentlyListened
                         * {
                         *  SongName = reader.GetString(songNameIndex),
                         *  Date = reader.GetDateTime(dateIndex),
                         *  BandName = reader.GetString(bandNameIndex),
                         *  Betyg = reader.GetInt32(betygIndex),
                         *  Length = reader.GetInt16(lengthIndex)
                         * });*/
                    }
                }
                return(recentlylistened);
            }
        }
        public IEnumerable<RecentlyListened> GetSongListByUserLatest(int medlemId)
        {
            using (var conn = CreateConnection())
            {
                List<RecentlyListened> recentlylistened = new List<RecentlyListened>();
                SqlCommand cmd = new SqlCommand("getSongListByUserLatest", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add("@medlemId", SqlDbType.Int, 4).Value = medlemId;

                conn.Open();
                cmd.ExecuteNonQuery();

                using (var reader = cmd.ExecuteReader())
                {
                    int songNameIndex = reader.GetOrdinal("SongName");
                    int dateIndex = reader.GetOrdinal("Date");
                    int lengthIndex = reader.GetOrdinal("Length");
                    int bandNameIndex = reader.GetOrdinal("BandName");
                    int betygIndex = reader.GetOrdinal("Betyg");
                    int songIdIndex = reader.GetOrdinal("SongId");
                    //Date, SongName, ConstrictedRows.Length, BandName, Betyg

                    while (reader.Read())
                    {
                        RecentlyListened rl = new RecentlyListened();
                        rl.SongName = reader.GetString(songNameIndex);
                        rl.Date = reader.GetDateTime(dateIndex);
                        rl.BandName = reader.GetString(bandNameIndex);
                        rl.Betyg = reader.GetInt32(betygIndex);
                        rl.Length = reader.GetInt16(lengthIndex);
                        rl.SongId = reader.GetInt32(songIdIndex);

                            recentlylistened.Add(rl);
                        /*recentlylistened.Add(new RecentlyListened
                        {
                            SongName = reader.GetString(songNameIndex),
                            Date = reader.GetDateTime(dateIndex),
                            BandName = reader.GetString(bandNameIndex),
                            Betyg = reader.GetInt32(betygIndex),
                            Length = reader.GetInt16(lengthIndex)
                        });*/
                    }
                }
                return recentlylistened;
            }
        }