public HttpResponseMessage GetPlaylists([FromUri] int id) { using (var db = new OnlineMusicEntities()) { var query = playlistDto.GetPlaylistQuery(db, playlist => playlist.UserId == id); var list = (from pl in query select pl).ToList(); return(Request.CreateResponse(HttpStatusCode.OK, list)); } }
public HttpResponseMessage GetAllPlaylists() { using (var db = new OnlineMusicEntities()) { var query = dto.GetPlaylistQuery(db); var listPlaylists = query.OrderByDescending(pl => pl.Id).ToList(); return(Request.CreateResponse(HttpStatusCode.OK, listPlaylists)); } }