public override EntityDto ConvertDto() { try { var dto = new UserPlantaDto { Id = Id, Codigo = Codigo, UserId = UserId, PlantaId = PlantaId }; if (Planta != null) { dto.PlantaDto = (UserDadosDto)Planta.ConvertDto(); } return(dto); } catch (Exception e) { ConsoleEx.WriteError(e); return(null); } }
public async Task <ActionResult <UserPlantaDto> > GetByHumanCode(UserPlantaDto 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 <UserPlantaDto>(responseCommand.Json)); } } } return(NotFound()); } catch (Exception e) { ConsoleEx.WriteError(e); return(NotFound()); } }