Implemented Song attribute deletion functionality #17

This commit is contained in:
amazing-username
2019-04-14 19:09:29 +00:00
parent c9b1abdbdb
commit 9f0d23f420
2 changed files with 27 additions and 1 deletions
+4 -1
View File
@@ -18,6 +18,7 @@ namespace Icarus.Controllers
{
#region Fields
private IConfiguration _config;
private MusicStoreContext _context;
private SongManager _songMgr;
#endregion
@@ -39,7 +40,7 @@ namespace Icarus.Controllers
public ActionResult<IEnumerable<Song>> Get()
{
List<Song> songs = new List<Song>();
songs = _songMgr.RetrieveAllSongDetails().Result;
//songs = _songMgr.RetrieveAllSongDetails().Result;
Console.WriteLine("Attemtping to retrieve songs");
MusicStoreContext context = HttpContext.RequestServices.GetService(typeof(MusicStoreContext)) as MusicStoreContext;
@@ -74,6 +75,8 @@ namespace Icarus.Controllers
[HttpDelete("{id}")]
public void Delete(int id)
{
MusicStoreContext context = HttpContext.RequestServices.GetService(typeof(MusicStoreContext)) as MusicStoreContext;
context.DeleteSong(id);
}
}
}