Code cleanup and conforming to a coding covention

This commit is contained in:
amazing-username
2019-07-04 17:19:40 -04:00
parent ada8fa79d3
commit 56fe805f80
28 changed files with 4274 additions and 4465 deletions
+49 -58
View File
@@ -13,73 +13,64 @@ using Icarus.Database.Repositories;
namespace Icarus.Controllers.V1
{
[Route("api/v1/artist")]
[ApiController]
public class ArtistController : ControllerBase
{
#region Fields
private readonly ILogger<ArtistController> _logger;
#endregion
[Route("api/v1/artist")]
[ApiController]
public class ArtistController : ControllerBase
{
#region Fields
private readonly ILogger<ArtistController> _logger;
#endregion
#region Properties
#endregion
#region Properties
#endregion
#region Constructors
public ArtistController(ILogger<ArtistController> logger)
{
_logger = logger;
}
#endregion
#region Constructors
public ArtistController(ILogger<ArtistController> logger)
{
_logger = logger;
}
#endregion
#region HTTP Routes
[HttpGet]
[Authorize("read:artists")]
public IActionResult Get()
{
ArtistRepository artistStoreContext = HttpContext
.RequestServices
.GetService(typeof(ArtistRepository)) as ArtistRepository;
#region HTTP Routes
[HttpGet]
[Authorize("read:artists")]
public IActionResult Get()
{
ArtistRepository artistStoreContext = HttpContext.RequestServices
.GetService(typeof(ArtistRepository)) as ArtistRepository;
var artists = artistStoreContext.GetArtists();
var artists = artistStoreContext.GetArtists();
if (artists.Count > 0)
{
return Ok(artists);
}
else
{
return NotFound();
}
}
if (artists.Count > 0)
return Ok(artists);
else
return NotFound();
}
[HttpGet("{id}")]
[Authorize("read:artists")]
public IActionResult Get(int id)
{
Artist artist = new Artist
{
ArtistId = id
};
ArtistRepository artistStoreContext = HttpContext
.RequestServices
.GetService(typeof(ArtistRepository)) as ArtistRepository;
[HttpGet("{id}")]
[Authorize("read:artists")]
public IActionResult Get(int id)
{
Artist artist = new Artist
{
ArtistId = id
};
ArtistRepository artistStoreContext = HttpContext.RequestServices
.GetService(typeof(ArtistRepository)) as ArtistRepository;
if (artistStoreContext.DoesArtistExist(artist))
{
artist = artistStoreContext.GetArtist(artist);
if (artistStoreContext.DoesArtistExist(artist))
{
artist = artistStoreContext.GetArtist(artist);
return Ok(artist);
}
else
{
return NotFound();
}
}
#endregion
}
return Ok(artist);
}
else
return NotFound();
}
#endregion
}
}