public async Task <ActionResult <UserDadosDto> > GetByHumanCode(UserDadosDto dto) { try { var myUsername = User.Identity.Name; if (ZZApiMain.VerifyUserAuthorize(myUsername)) { if (ZZApiMain.UsersConnections.TryGetValue(myUsername, out var myConn)) { var myId = await myConn.Zz.ApiWriteServer(myUsername, new Command { Cmd = ServerCommands.GetById, EntityId = dto.Id, Tela = Tela, Json = await SerializerAsync.SerializeJson(dto) }); var responseCommand = await myConn.Zz.GetApiWaitCommand(myId); if (responseCommand != null && responseCommand.Cmd.Equals(ServerCommands.LogResultOk)) { return(await SerializerAsync.DeserializeJson <UserDadosDto>(responseCommand.Json)); } } } return(NotFound()); } catch (Exception e) { ConsoleEx.WriteError(e); return(NotFound()); } }
public override EntityDto ConvertDto() { try { var dto = new UserDadosDto { Id = Id, Codigo = Codigo, NomeFantasia = NomeFantasia, RazaoSocial = RazaoSocial, Email = Email, Telefone = Telefone }; dto.ValidatorDocument(Documento); dto.Endereco = (EnderecoDto)Endereco.ConvertDto(); return(dto); } catch (Exception e) { ConsoleEx.WriteError(e); return(null); } }