Created Http endpoints for album and artists. Added Album and Artist models. #25, #26, #19, #20

This commit is contained in:
amazing-username
2019-05-04 01:08:52 -04:00
parent b0265ebc97
commit 226e95248c
4 changed files with 110 additions and 0 deletions
+37
View File
@@ -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<Album> albums = new List<Album>();
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();
}
}
}
+39
View File
@@ -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<Artist> artists = new List<Artist>();
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();
}
}
}
+18
View File
@@ -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; }
}
}
+16
View File
@@ -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; }
}
}