public ActionResult DeleteAlbumForBand(Guid bandId, Guid albumId) { if (!_bandAlbumRepository.BandExists(bandId)) { return(NotFound()); } var album = _bandAlbumRepository.GetAlbum(bandId, albumId); if (album == null) { return(NotFound()); } _bandAlbumRepository.DeleteAlbum(album); return(NoContent()); }
public ActionResult DeleteAlbumFromBand(Guid bandId, Guid albumId) { if (!_repository.BandExists(bandId)) { return(NotFound()); } var albumFromRepo = _repository.GetAlbum(bandId, albumId); if (albumFromRepo == null) { return(NotFound()); } _repository.DeleteAlbum(albumFromRepo); _repository.Save(); return(NoContent()); }
public ActionResult DeleteAlbum(Guid albumId) { if (albumId == null) { throw new ArgumentNullException(nameof(albumId)); } var albumFromRepo = _repository.GetAlbum(albumId); if (albumFromRepo == null) { return(NotFound()); } _repository.DeleteAlbum(albumId); _repository.Save(); return(NoContent()); }
public IActionResult DeleteAlbum(Guid albumId, Guid bandId) { if (!_bandAlbumRepository.BandExists(bandId)) { return(StatusCode(StatusCodes.Status404NotFound)); } var albumToDelete = _bandAlbumRepository.GetAlbum(bandId, albumId); if (albumToDelete == null) { return(StatusCode(StatusCodes.Status404NotFound)); } _bandAlbumRepository.DeleteAlbum(albumToDelete); _bandAlbumRepository.Save(); return(StatusCode(StatusCodes.Status204NoContent)); }
public ActionResult DeleteAlbumForBand(Guid bandId, Guid albumId) { if (!_bandAlbumRepository.BandExists(bandId)) { return NotFound(); } Album albumEntity = _bandAlbumRepository.GetAlbum(bandId, albumId); if (albumEntity == null) { return NotFound(); } _bandAlbumRepository.DeleteAlbum(albumEntity); _bandAlbumRepository.Save(); return NoContent(); }
public ActionResult DeleteAlbumForBand(Guid bandID, Guid albumID) { if (!_bandAlbumRepository.BandExists(bandID)) { return(NotFound()); } var albumFromRepo = _bandAlbumRepository.GetAlbum(bandID, albumID); if (albumFromRepo is null) { return(NotFound()); } _bandAlbumRepository.DeleteAlbum(albumFromRepo); _bandAlbumRepository.Save(); return(NoContent()); }
public async Task <ActionResult> DeleteAlbum(Guid bandId, Guid albumId) { if (!await _bandAlbumRepository.BandExists(bandId)) { return(NotFound()); } var albumFromRepo = await _bandAlbumRepository.GetAlbum(bandId, albumId); if (albumFromRepo == null) { return(NotFound()); } _bandAlbumRepository.DeleteAlbum(albumFromRepo); await _bandAlbumRepository.Save(); return(Ok(_mapper.Map <AlbumDto>(albumFromRepo))); }