@@ -44,23 +44,38 @@ namespace Icarus.Controllers
|
|||||||
|
|
||||||
albums = albumStoreContext.GetAlbums();
|
albums = albumStoreContext.GetAlbums();
|
||||||
|
|
||||||
|
if (albums.Count > 0)
|
||||||
return Ok(albums);
|
{
|
||||||
|
return Ok(albums);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return NotFound();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("{id}")]
|
[HttpGet("{id}")]
|
||||||
public IActionResult Get(int id)
|
public IActionResult Get(int id)
|
||||||
{
|
{
|
||||||
Album album = new Album();
|
Album album = new Album
|
||||||
album.AlbumId = id;
|
{
|
||||||
|
AlbumId = id
|
||||||
|
};
|
||||||
|
|
||||||
AlbumStoreContext albumStoreContext = HttpContext
|
AlbumStoreContext albumStoreContext = HttpContext
|
||||||
.RequestServices
|
.RequestServices
|
||||||
.GetService(typeof(AlbumStoreContext)) as AlbumStoreContext;
|
.GetService(typeof(AlbumStoreContext)) as AlbumStoreContext;
|
||||||
|
|
||||||
album = albumStoreContext.GetAlbum(album);
|
if (albumStoreContext.DoesAlbumExist(album))
|
||||||
|
{
|
||||||
|
album = albumStoreContext.GetAlbum(album);
|
||||||
|
|
||||||
return Ok(album);
|
return Ok(album);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return NotFound();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ namespace Icarus.Models.Context
|
|||||||
{
|
{
|
||||||
album = ParseSingleData(reader);
|
album = ParseSingleData(reader);
|
||||||
|
|
||||||
if (album != null)
|
if (album.Title != null)
|
||||||
{
|
{
|
||||||
_logger.Info($"Album {album.Title} exists");
|
_logger.Info($"Album {album.Title} exists");
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user