Exemple #1
0
        public async Task <IActionResult> DeleteGenre([FromRoute] long id)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var genre = await _genreRepository.GetGenreByIdAsync(id);

            if (genre == null)
            {
                return(BadRequest(new { message = "Can't delete this genre", status = 400 }));
            }

            await _genreRepository.DeleteGenreAsync(id);

            return(Ok(new { message = "Delete Success", status = 200, result = genre }));
        }