From 226e95248cebdaafc15dfbc4958a626caa3512d0 Mon Sep 17 00:00:00 2001 From: amazing-username Date: Sat, 4 May 2019 01:08:52 -0400 Subject: [PATCH] Created Http endpoints for album and artists. Added Album and Artist models. #25, #26, #19, #20 --- Controllers/AlbumController.cs | 37 +++++++++++++++++++++++++++++++ Controllers/ArtistController.cs | 39 +++++++++++++++++++++++++++++++++ Models/Album.cs | 18 +++++++++++++++ Models/Artist.cs | 16 ++++++++++++++ 4 files changed, 110 insertions(+) create mode 100644 Controllers/AlbumController.cs create mode 100644 Controllers/ArtistController.cs create mode 100644 Models/Album.cs create mode 100644 Models/Artist.cs diff --git a/Controllers/AlbumController.cs b/Controllers/AlbumController.cs new file mode 100644 index 0000000..404ffaf --- /dev/null +++ b/Controllers/AlbumController.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Configuration; + +using Microsoft.AspNetCore.Mvc; + +using Icarus.Models; + +namespace Icarus.Controllers +{ + [Route("api/album")] + [ApiController] + public class AlbumController : ControllerBase + { + [HttpGet] + public IActionResult Get() + { + List albums = new List(); + + return Ok(albums); + } + + [HttpGet("{id}")] + public IActionResult Get(int id) + { + Album album = new Album(); + + return Ok(album); + } + + [HttpDelete("{id}")] + public IActionResult Delete(int id) + { + return Ok(); + } + } +} diff --git a/Controllers/ArtistController.cs b/Controllers/ArtistController.cs new file mode 100644 index 0000000..3c3a43f --- /dev/null +++ b/Controllers/ArtistController.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Linq; + +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Configuration; + +using Icarus.Models; + +namespace Icarus.Controllers +{ + [Route("api/artist")] + [ApiController] + public class ArtistController : ControllerBase + { + [HttpGet] + public IActionResult Get() + { + List artists = new List(); + + return Ok(artists); + } + + [HttpGet("{id}")] + public IActionResult Get(int id) + { + Artist artist = new Artist(); + + return Ok(artist); + } + + [HttpDelete("{id}")] + public IActionResult Delete(int id) + { + return Ok(); + } + } +} diff --git a/Models/Album.cs b/Models/Album.cs new file mode 100644 index 0000000..95e3226 --- /dev/null +++ b/Models/Album.cs @@ -0,0 +1,18 @@ +using System; + +using Newtonsoft.Json; + +namespace Icarus.Models +{ + public class Album + { + [JsonProperty("id")] + public int Id { get; set; } + [JsonProperty("title")] + public string Title { get; set; } + [JsonProperty("album_artist")] + public string AlbumArtist { get; set; } + [JsonProperty("song_count")] + public int SongCount { get; set; } + } +} diff --git a/Models/Artist.cs b/Models/Artist.cs new file mode 100644 index 0000000..102498d --- /dev/null +++ b/Models/Artist.cs @@ -0,0 +1,16 @@ +using System; + +using Newtonsoft.Json; + +namespace Icarus.Models +{ + public class Artist + { + [JsonProperty("id")] + public int Id { get; set; } + [JsonProperty("name")] + public string Name { get; set; } + [JsonProperty("song_count")] + public int SongCount { get; set; } + } +}