コード例 #1
0
        public async Task <IActionResult> DeleteArtists([FromBody] int[] ids)
        {
            try
            {
                var allExist = await _artistService.ArtistIdsExistAsync(ids);

                if (!allExist)
                {
                    return(NotFound(new ErrorResponse(ErrorMessages.Artist.DoesNotExistBulk)));
                }

                var deleted = await _artistService.DeleteArtistsAsync(ids);

                if (deleted)
                {
                    return(NoContent());
                }

                return(NotFound(new ErrorResponse(ErrorMessages.Artist.DoesNotExistBulk)));
            }
            catch (Exception ex)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError, new ErrorResponse(ErrorMessages.Artist.FailedDeleteBulk)));
            }
        }