public async Task <GetArtistDTO> GetArtist(int id) { Artist artist = await _db.Artists.AsNoTracking().FirstOrDefaultAsync(p => p.ArtistId == id); GetArtistDTO artistdto = _mapper.Map <GetArtistDTO>(artist); return(artistdto); }
public async Task <DataRespone <GetArtistDTO> > getArtist(int id) { if (id == 0) { throw new MyBadRequestException(HttpStatusCode.BadRequest, "ArtistID must be not null."); } GetArtistDTO artist = await _artistService.GetArtist(id); if (artist == null) { throw new MyNotFoundException(HttpStatusCode.NotFound, "Artist have not found."); } return(new DataRespone <GetArtistDTO>() { Ok = true, data = artist, error = "" }); }