コード例 #1
0
 public ActionResult <ArtistDto> Get(Guid id)
 {
     try
     {
         return(Ok(new ArtistDto().MapFromModel(
                       _artistBll.GetById(id))));
     }
     catch (ArgumentOutOfRangeException exception)
     {
         Console.Write(exception.Message);
         return(NotFound());
     }
 }
コード例 #2
0
 public ActionResult <ICollection <TrackDto> > Get()
 {
     try
     {
         var artistId = new Guid(Request.Query.FirstOrDefault(r => r.Key == "ArtistId").Value.ToString());
         var artist   = _artistBll.GetById(artistId);
         return(Ok(artist.TrackList.Select(t => new TrackDto().MapFromModel(t))));
     }
     catch (ArgumentOutOfRangeException exception)
     {
         Console.Write(exception.Message);
         return(NotFound());
     }
 }