public async Task <ICommandResult> Handle(CharacteristicDescriptionDeleteCommand command) { //FFV command.Validate(); if (command.Invalid) { return(new GenericCommandResult( false, HttpStatusCode.BadRequest, command.Notifications)); } var _verify = await _characteristicDescriptionRepository.FindById(command.Id); if (_verify == null) { return(new GenericCommandResult(false, HttpStatusCode.NotFound, "Não localizado na base")); } var _entity = new CharacteristicDescription { Id = command.Id }; var _result = await _cudRepository.Delete(_entity); //retorna o resultado if (!_result) { return(new GenericCommandResult(false, HttpStatusCode.BadRequest, _result)); } return(new GenericCommandResult(true, HttpStatusCode.OK, _result)); }
public async Task <GenericCommandResult> DeleteCharacteristicDescription( [FromQuery] int id, [FromServices] IHandler <CharacteristicDescriptionDeleteCommand> handler) { var command = new CharacteristicDescriptionDeleteCommand(id); return((GenericCommandResult)await handler.Handle(command)); }