public IActionResult AddTrackToArtist(long id, [FromBody] TrackDto trackDto) { try { _artistService.AddTrackToArtist(id, trackDto); } catch (ArgumentException e) { log.LogError("Error on addind a new track." + e.Message); return(NotFound(StatusCodes.Status404NotFound)); } return(Ok(StatusCodes.Status200OK)); }
public IActionResult AddTrackToArtist(long id) { DateTime now = DateTime.Now; TrackDTO trackDTO = new TrackDTO(1, "My Collection", 415, now); try { ArtistService.AddTrackToArtist(id, trackDTO); } catch (ArgumentException e) { log.LogError("An artist with the id :" + id + " does not exist." + e.Message); return(NotFound(StatusCodes.Status404NotFound)); } return(Ok(StatusCodes.Status200OK)); }