Ejemplo n.º 1
0
            public async Task <Unit> Handle(Execute request, CancellationToken cancellationToken)
            {
                var comment = await _context.Comment.FindAsync(request.CommentId);

                if (comment == null)
                {
                    throw new ExceptionHandler(
                              HttpStatusCode.NotFound,
                              new { message = "No se encontró el curso" }
                              );
                }

                _context.Remove(comment);

                return(await _context.SaveChangesAsync() > 0 ?
                       Unit.Value : throw new Exception("No se pudo eliminar el curso"));
            }