diff --git a/TeamDBAwesome/TeamDBAwesome/js/adminController.js b/TeamDBAwesome/TeamDBAwesome/js/adminController.js index 4881473..a007aa0 100644 --- a/TeamDBAwesome/TeamDBAwesome/js/adminController.js +++ b/TeamDBAwesome/TeamDBAwesome/js/adminController.js @@ -16,13 +16,14 @@ angular.module('routerApp').controller('adminController', function ($scope, $htt /* BEGIN LOGIC */ + //New Media $scope.showMediaOptions = true; $scope.showTrackFields = false; $scope.showAlbumFields = false; $scope.showArtistFields = false; $scope.showGenreFields = false; $scope.showMediaTypeFields = false; - $scope.editing = false; + $scope.back = function () { @@ -49,7 +50,9 @@ angular.module('routerApp').controller('adminController', function ($scope, $htt $scope.toCreateMediaType = function () { $scope.showMediaOptions = false; }; + //End New Media + //CustomerDemographics $scope.gridOptions = { enableFiltering: true, columnDefs: [ @@ -83,9 +86,26 @@ angular.module('routerApp').controller('adminController', function ($scope, $htt } ] + //End Customer Demographics + + //Playlist Editor + $scope.editing = false; + $scope.currentPlaylist = 0; + + $scope.addPlaylist = function () { + var name = prompt("Enter the name of the playlist"); + if (name != null) { + $http.get("http://localhost:50031/api/AddPlaylist?playlistname=" + name) + .success(function (response) { + console.log(response); + }) + } + $scope.getPlaylists(); + } $scope.toEdit = function (playlistID) { $scope.editing = true; + $scope.currentPlaylist = playlistID; $scope.getPlaylistTracks(playlistID); } @@ -97,6 +117,21 @@ angular.module('routerApp').controller('adminController', function ($scope, $htt console.log(response); }) } + + $scope.deletePlaylist = function (playlistID) { + if (confirm("Are you sure you want to delete this playlist? \nPress OK to confirm") == true) { + $scope.dropPlaylist(playlistID); + } + $scope.getPlaylists(); + } + + $scope.dropPlaylist = function (playlistID) { + $http.get("http://localhost:50031/api/DropPlaylist?PlaylistID="+ playlistID) + .success(function (response) { + console.log(response); + }) + } + $scope.getPlaylistTracks = function (playlistID) { $scope.playlistTracks = []; $http.get("http://localhost:50031/api/GetPlaylist?PlaylistID="+ playlistID) @@ -105,5 +140,13 @@ angular.module('routerApp').controller('adminController', function ($scope, $htt console.log(response); }) - } + } + + $scope.deleteTrack = function (trackID) { + if (confirm("Are you sure you want to delete this track from this playlist? \nPress OK to confirm") == true) { + $scope.dropTrack(trackID); + } + } + + //End Playlist Editor }); \ No newline at end of file diff --git a/TeamDBAwesome/TeamDBAwesome/pages/admin-playlist-manager.html b/TeamDBAwesome/TeamDBAwesome/pages/admin-playlist-manager.html index 429b243..f75441d 100644 --- a/TeamDBAwesome/TeamDBAwesome/pages/admin-playlist-manager.html +++ b/TeamDBAwesome/TeamDBAwesome/pages/admin-playlist-manager.html @@ -4,7 +4,7 @@
- Create New Playlist + Create New Playlist @@ -16,7 +16,7 @@ - +
Playlist Id{{ playlist.PlaylistID }} {{ playlist.Name }} EditDeleteDelete
@@ -37,7 +37,7 @@ {{ track.artist }} {{ track.Milliseconds }} {{ track.UnitPrice | currency }} - Delete + Delete