コード例 #1
0
        public async Task <ActionResult> DeleteCommand([FromRoute] string id)
        {
            try
            {
                var commandToDelete = await _repository.GetCommandByIdAsync(new Guid(id));

                if (commandToDelete == null)
                {
                    return(NotFound("O recurso que você deseja excluir não foi encontrado"));
                }

                await _repository.DeleteCommandAsync(commandToDelete);

                await _repository.SaveChangesAsync();

                return(NoContent());
            }
            catch (Exception ex)
            {
                return(ValidationProblem(ex.Message));
            }
        }