public ResponseEnvelope Response(DesconectarResponse response) { var envelope = new ResponseEnvelope(); envelope.HttpStatusCode = (HttpStatusCode)response.HttpStatusCode; if (!envelope.Success) { envelope.Error = new ErrorEnvelope() { Exception = new Exception(response.Erro), Messages = new System.Collections.Generic.List <string> { response.Erro } }; } return(envelope); }
public override Task <DesconectarResponse> Desconectar(DesconectarRequest request, ServerCallContext context) { var response = new DesconectarResponse(); try { var perfil = desconectar.Request(request); perfilService.Desconectar(perfil); response.HttpStatusCode = (int)HttpStatusCode.OK; } catch (Exception ex) { response.Erro = ex.Message; response.HttpStatusCode = (int)HttpStatusCode.InternalServerError; } return(Task.FromResult(response)); }