Adding Index ActionResult (3)
Full code shown below.
public ActionResult Index()
{
IList<SongModel> SongList = new List<SongModel>();
var query = from song in context.Songs
join genre in context.Genres
on song.GenreId equals genre.Id
select new SongModel
{
Id = song.Id,
Title = song.Title,
Singer = song.Singer,
Year = song.Year,
Writer = song.Writer,
GenreName = genre.Name
};
SongList = query.ToList();
return View(SongList);
}