LyricContext db = new LyricContext();
public HttpResponseMessage Get()
{
var json = from M in db.Musics
select new MusicDTO
{
ID = M.ID,
MusicName = M.MusicName,
Lyric = M.Lyric,
Albume = M.Albume.AlbumeName,
Artist = M.Albume.Artist.ArtistName
};
if (json.Any())
{
return Request.CreateResponse(HttpStatusCode.OK, new { musics = json.OrderBy(c => c.ID) });
}
else
{
return Request.CreateResponse(HttpStatusCode.NotFound, new { musics = "No Data Available" });
}
}