public async Task <ICommandResult> Handle(CharacteristicKeyUpdateCommand command) { //FFV command.Validate(); if (command.Invalid) { return(new GenericCommandResult( false, HttpStatusCode.BadRequest, command.Notifications)); } var _verify = await _characteristicKeyRepository.FindByIdTabela(command.Id); if (_verify == null) { return(new GenericCommandResult(false, HttpStatusCode.NotFound, "Não localizado na base")); } var _entity = new CharacteristicKey { Id = command.Id, CharacteristicId = command.characteristicId, Description = command.Description }; var _result = await _cudRepository.Update(_entity); //retorna o resultado if (!_result) { return(new GenericCommandResult(false, HttpStatusCode.BadRequest, _result)); } return(new GenericCommandResult(true, HttpStatusCode.OK, _result)); }
public async Task <GenericCommandResult> UpdateCharacteristic( [FromBody] CharacteristicKeyUpdateCommand command, [FromServices] IHandler <CharacteristicKeyUpdateCommand> handler) { return((GenericCommandResult)await handler.Handle(command)); }