Skip to content
Permalink
Browse files

Got the playlist track screen working

  • Loading branch information
sec11008 committed Dec 8, 2015
1 parent c586354 commit b0d9c00313619e60ae5b306316ee76853e28a9cf
@@ -234,7 +234,6 @@
<Content Include="pages\admin-mediacenter.html" />
<Content Include="pages\admin-view.html" />
<Content Include="index.html" />
<Content Include="pages\admin-edit-playlist.html" />
<Content Include="pages\new-media.html" />
<Content Include="pages\partial-adminlogin.html" />
<Content Include="pages\partial-home.html" />
@@ -22,6 +22,7 @@ angular.module('routerApp').controller('adminController', function ($scope, $htt
$scope.showArtistFields = false;
$scope.showGenreFields = false;
$scope.showMediaTypeFields = false;
$scope.editing = false;


$scope.back = function () {
@@ -83,15 +84,26 @@ angular.module('routerApp').controller('adminController', function ($scope, $htt
}
]

$scope.toEdit = function (playlistID) {
$scope.editing = true;
$scope.getPlaylistTracks(playlistID);
}

$scope.getPlaylists = function () {
console.log($scope.playlists);
$scope.playlists = [];
$http.get("http://localhost:50031/api/GetPlaylistList")
.success(function (response) {
$scope.playlists = angular.copy(response);
console.log(response);
})
}
$scope.getPlaylistTracks = function (playlistID) {
$scope.playlistTracks = [];
$http.get("http://localhost:50031/api/GetPlaylist?PlaylistID="+ playlistID)
.success(function (response) {
$scope.playlistTracks = angular.copy(response);
console.log(response);
})

}
});

This file was deleted.

@@ -2,14 +2,43 @@
<title>Playlist Editor</title>
<meta charset="utf-8" />
</head>
<div ng-controller="adminController" ng-init="getPlaylists();">
<a>Create New Playlist</a>
<table>
<tr ng-repeat="playlist in playlists">
<td>{{ playlist.PlaylistID }}</td>
<td>{{ playlist.Name }}</td>
<td><a ui-sref="admin-edit-playlist">Edit</a></td>
<td><a ui-sref="admin-delete-playlist">Delete</a></td>
</tr>
</table>
</div>
<div ng-controller="adminController">
<div ng-hide="editing" ng-init="getPlaylists();">
<a>Create New Playlist</a>
<table>
<tr>
<td>Playlist Id</td>
<td>Playlist Name</td>
<td></td>
<td></td>
</tr>
<tr ng-repeat="playlist in playlists">
<td>{{ playlist.PlaylistID }}</td>
<td>{{ playlist.Name }}</td>
<td><a ng-click="toEdit(playlist.PlaylistID);">Edit</a></td>
<td><a ui-sref="admin-delete-playlist">Delete</a></td>
</tr>
</table>
</div>
<div ng-show="editing">
<a ng-click="editing=false;" ui-sref="admin-playlist-manager" class="btn btn-lg btn-primary center-block">Back</a>
<table>
<tr>
<td>Track Id</td>
<td>Track Name</td>
<td>Artist</td>
<td>Length</td>
<td>Price</td>
<td></td>
</tr>
<tr ng-repeat="track in playlistTracks">
<td>{{ track.TrackId }}</td>
<td>{{ track.TrackName }}</td>
<td>{{ track.artist }}</td>
<td>{{ track.Milliseconds }}</td>
<td>{{ track.UnitPrice | currency }}</td>
<td><a ui-sref="admin-delete-playlist">Delete</a></td>
</tr>
</table>
</div>
</div>

0 comments on commit b0d9c00

Please sign in to comment.
You can’t perform that action at this time.