public bool DeleteMovie(Film film) { if (movieDao.FindMovieById(film.Id) != null) { List <Commentaire_Note> comment = commentsDao.FindCommentsByMovie(film.Id); if (comment != null) { foreach (Commentaire_Note delete in comment) { commentsDao.DeleteComments(delete); } } return(movieDao.DeleteMovie(film)); } return(false); }
public override async Task <Services.DeleteMovieResponse> DeleteMovie(Services.DeleteMovieRequest request, ServerCallContext context) { if (request is null) { throw new ArgumentNullException(nameof(request)); } if (!_validator.IsValidDeleteMovieRequest(request, out var trailers)) { throw NewInvalidArgumentRpcException("Invalid movie id", trailers); } var movie = await _movieDao .DeleteMovie(request.MovieId) .ConfigureAwait(true); return(new Services.DeleteMovieResponse { MovieId = movie.Id.ToString() }); }