Finished API functionality for Genre and Year endpoints. #41 and #42. Working on refining the updating song api route that's part of the clean up issue. #37

This commit is contained in:
amazing-username
2019-05-18 02:09:59 -04:00
parent 30abf31877
commit 41398461be
5 changed files with 93 additions and 18 deletions
+13 -5
View File
@@ -42,8 +42,7 @@ namespace Icarus.Controllers
[HttpGet]
// TODO: Remember to uncomment the line below
//[Authorize("read:song_details")]
[Authorize("read:song_details")]
public IActionResult Get()
{
List<Song> songs = new List<Song>();
@@ -67,8 +66,7 @@ namespace Icarus.Controllers
}
[HttpGet("{id}")]
// TODO: Remember to uncomment the line below
//[Authorize("read:song_details")]
[Authorize("read:song_details")]
public IActionResult Get(int id)
{
MusicStoreContext context = HttpContext
@@ -103,7 +101,14 @@ namespace Icarus.Controllers
AlbumStoreContext albumStore = HttpContext
.RequestServices
.GetService(typeof(AlbumStoreContext)) as AlbumStoreContext;
// TODO: Add the GenreStoreContext and YearStoreContext #41 and #42
GenreStoreContext genreStore = HttpContext
.RequestServices
.GetService(typeof(GenreStoreContext)) as GenreStoreContext;
YearStoreContext yearStore = HttpContext
.RequestServices
.GetService(typeof(YearStoreContext)) as YearStoreContext;
song.Id = id;
Console.WriteLine("Retrieving filepath of song");
@@ -118,6 +123,9 @@ namespace Icarus.Controllers
}
// TODO: Provide functionality for the UpdateSong(...) method
// before removing the below return statement
var songRes = _songMgr.UpdateSong(song, context, albumStore, artistStore, genreStore,
yearStore);
return Ok("song exists");
var oldSongRecord = context.GetSong(id);