Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Got the playlist track screen working
  • Loading branch information
sec11008 committed Dec 8, 2015
1 parent c586354 commit b0d9c00
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 21 deletions.
1 change: 0 additions & 1 deletion TeamDBAwesome/TeamDBAwesome/TeamDBAwesome.csproj
Expand Up @@ -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" />
Expand Down
14 changes: 13 additions & 1 deletion TeamDBAwesome/TeamDBAwesome/js/adminController.js
Expand Up @@ -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 () {
Expand Down Expand Up @@ -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);
})

}
});
8 changes: 0 additions & 8 deletions TeamDBAwesome/TeamDBAwesome/pages/admin-edit-playlist.html

This file was deleted.

51 changes: 40 additions & 11 deletions TeamDBAwesome/TeamDBAwesome/pages/admin-playlist-manager.html
Expand Up @@ -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.