public async Task <ActionResult <TabelaDto> > GetByHumanCode(TabelaDto 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 <TabelaDto>(responseCommand.Json)); } } } return(NotFound()); } catch (Exception e) { ConsoleEx.WriteError(e); return(NotFound()); } }
public override EntityDto ConvertDto() { try { var dto = new TabelaDto { Id = Id, Description = Descricao, Price = Preco, TableDate = DataTabela, Codigo = Codigo }; return(dto); } catch (Exception e) { ConsoleEx.WriteError(e); return(null); } }