internal object Delete(int id) { DTOArtistGenre exists = Get(id); _repo.Delete(id); return(exists); }
internal DTOArtistGenre Create(DTOArtistGenre newArtistGenre) { int id = _repo.Create(newArtistGenre); newArtistGenre.Id = id; return(newArtistGenre); }
public DTOArtistGenre Get(int Id) { DTOArtistGenre exists = _repo.GetById(Id); if (exists == null) { throw new Exception("Invalid ArtistGenre Id"); } return(exists); }
internal int Create(DTOArtistGenre newArtistGenre) { string sql = @" INSERT INTO artistgenre (artistId, genreId) VALUES (@ArtistId, @GenreId); SELECT LAST_INSERT_ID();"; return(_db.ExecuteScalar <int>(sql, newArtistGenre)); }
public ActionResult <DTOArtistGenre> Post([FromBody] DTOArtistGenre newDTOArtistGenre) { try { return(Ok(_service.Create(newDTOArtistGenre))); } catch (Exception e) { return(BadRequest(e.Message)); } }