예제 #1
0
        protected override void Execute(NativeActivityContext context)
        {
            if (!string.IsNullOrEmpty(ProxyHost.Get(context)))         // Proxy defined
            {
                if (!string.IsNullOrEmpty(ProxyUsername.Get(context))) // Proxy authentication
                {
                    connectionInfo = new PasswordConnectionInfo(Host.Get(context), Port.Get(context), Username.Get(context), Encoding.UTF8.GetBytes(Password.Get(context)), ProxyTypes.Http, ProxyHost.Get(context), ProxyPort.Get(context), ProxyUsername.Get(context), ProxyPassword.Get(context));
                }
                else // No proxy authentication
                {
                    connectionInfo = new PasswordConnectionInfo(Host.Get(context), Port.Get(context), Username.Get(context), Password.Get(context), ProxyTypes.Http, ProxyHost.Get(context), ProxyPort.Get(context));
                }
            }
            else // No Proxy defined
            {
                connectionInfo = new PasswordConnectionInfo(Host.Get(context), Port.Get(context), Username.Get(context), Password.Get(context));
            }

            sshClient = new SshClient(connectionInfo);
            sshClient.Connect();

            if (Body != null)
            {
                //scheduling the execution of the child activities
                // and passing the value of the delegate argument
                context.ScheduleAction(Body, sshClient, OnCompleted, OnFaulted);
            }
        }
예제 #2
0
        /// <summary>
        /// Returns a WebProxy instance configured to match the proxy settings
        /// in the client configuration.
        /// </summary>
        public WebProxy GetWebProxy()
        {
            const string httpPrefix = "http://";

            WebProxy proxy = null;

            if (!string.IsNullOrEmpty(ProxyHost) && ProxyPort > 0)
            {
                // WebProxy constructor adds the http:// prefix, but doesn't
                // account for cases where it's already present which leads to
                // malformed addresses
                var host = ProxyHost.StartsWith(httpPrefix, StringComparison.OrdinalIgnoreCase)
                               ? ProxyHost.Substring(httpPrefix.Length)
                               : ProxyHost;
                proxy = new WebProxy(host, ProxyPort);

                if (ProxyCredentials != null)
                {
                    proxy.Credentials = ProxyCredentials;
                }
                if (ProxyBypassList != null)
                {
                    proxy.BypassList = ProxyBypassList.ToArray();
                }
                proxy.BypassProxyOnLocal = ProxyBypassOnLocal;
            }

            return(proxy);
        }
예제 #3
0
        public string PostReview([FromBody] dynamic id)
        {
            //ObservableCollection<Dictionary<string, object>> detailcollection = new ObservableCollection<Dictionary<string, object>>();
            //Dictionary<string, object> InvoiceStatus = new Dictionary<string, object>();
            string InvoiceId = string.Empty;

            try
            {
                ObservableCollection <IDictionary <string, object> > obj = JsonConvert.DeserializeObject <ObservableCollection <IDictionary <string, object> > >(Convert.ToString(id));
                string Status = string.Empty;
                foreach (Dictionary <string, object> header in obj)
                {
                    //Status = header["Status"].ToString();
                    prxyhost = JsonConvert.DeserializeObject <ProxyHost>(Convert.ToString(header["hostHeader"].ToString()));


                    //Invoicedetail = JsonConvert.DeserializeObject<List<ProxyInvoiceDetails>>(Convert.ToString(header["SalesDetail"].ToString()));
                }
                TblReviews _tblReview = new TblReviews();
                _tblReview.HostId = prxyhost.HostID;
                _tblReview.UserId = prxyhost.UserID;
                _tblReview.Review = prxyhost.Review;
                _TripstarContext.Add(_tblReview);

                _TripstarContext.SaveChanges();

                //return _repository.PostInvoice(Status, Headerdata, Invoicedetail);
                return("true");
            }
            catch (Exception ex)
            {
                return("false");
            }
        }
예제 #4
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (ProxyEnabled != null)
         {
             hashCode = hashCode * 59 + ProxyEnabled.GetHashCode();
         }
         if (ProxyHost != null)
         {
             hashCode = hashCode * 59 + ProxyHost.GetHashCode();
         }
         if (ProxyPort != null)
         {
             hashCode = hashCode * 59 + ProxyPort.GetHashCode();
         }
         if (ProxyUser != null)
         {
             hashCode = hashCode * 59 + ProxyUser.GetHashCode();
         }
         if (ProxyPassword != null)
         {
             hashCode = hashCode * 59 + ProxyPassword.GetHashCode();
         }
         if (ProxyExceptions != null)
         {
             hashCode = hashCode * 59 + ProxyExceptions.GetHashCode();
         }
         return(hashCode);
     }
 }
예제 #5
0
 public ComplexTypeStubBackReference GetComplexObjectWithBackReference()
 {
     return(new ComplexTypeStubBackReference
     {
         ABC = "DEF",
         Proxy = ProxyHost.CreateProxy(this)
     });
 }
예제 #6
0
 public ComplexTypeWithProxy GetComplexTypeWithProxy()
 {
     return(new ComplexTypeWithProxy
     {
         ProxyName = "MyProxy",
         Proxy = ProxyHost.CreateProxy(new Value(23))
     });
 }
예제 #7
0
 public ComplexTypeWithTransparentProxy GetComplexTypeWithTransparentProxy()
 {
     return(new ComplexTypeWithTransparentProxy
     {
         ProxyName = "MyProxy",
         Proxy = ProxyHost.CreateProxy(new Value(23)).Cast <IValue>().AsTransparentProxy()
     });
 }
예제 #8
0
 internal Proxy(ProxyHost host, int id, Type objectType)
 {
     _host          = host;
     Id             = id;
     _objectType    = objectType;
     _isActivated   = true;
     _disposeHelper = new AsyncDisposeHelper(DisposeInternalAsync);
 }
예제 #9
0
 internal Proxy(ProxyHost proxyHost, int id, ActivationMode activationMode, object[] activationParameters)
 {
     _host              = proxyHost;
     Id                 = id;
     ActivationMode     = activationMode;
     ActivationParamers = activationParameters;
     _isActivated       = false;
     _disposeHelper     = new AsyncDisposeHelper(DisposeInternalAsync);
 }
예제 #10
0
            public async Task OnStoppingServiceAsync(OperationContext context)
            {
                if (ProxyService != null)
                {
                    await ProxyService.ShutdownAsync(context).IgnoreFailure();
                }
                // Not passing cancellation token since it will already be signaled
                await ProxyHost.StopAsync();

                ProxyHost.Dispose();
            }
예제 #11
0
        public async Task SyncCallWithResultTest()
        {
            using (var fs1 = new FloatingStream())
                using (var fs2 = new FloatingStream())
                    using (var mux1 = new MultiplexStream(fs1, fs2))
                        using (var mux2 = new MultiplexStream(fs2, fs1))
                        {
                            var remoteProxyHost = new ProxyHost(mux1, BuildServiceProvider());
                            var localProxyHost  = new ProxyHost(mux2, BuildServiceProvider());

                            var fooProxy = await localProxyHost.CreateAsync <Foo>(cancellation : default);
예제 #12
0
            public async Task OnStartingServiceAsync(OperationContext context)
            {
                OperationContext.Value            = context;
                ConfigurationSource.Configuration = ProxyHost.Services.GetService <ProxyServiceConfiguration>();

                // Get and start the DeploymentProxyService
                ProxyService = ProxyHost.Services.GetService <DeploymentProxyService>();

                await ProxyService.StartupAsync(context).IgnoreFailure();

                await ProxyHost.StartAsync(context.Token);
            }
예제 #13
0
        /// <summary>
        /// Creates a remote TCP connection through a proxy server to the destination host on the destination port.
        /// </summary>
        /// <param name="destinationHost">Destination host name or IP address.</param>
        /// <param name="destinationPort">Port number to connect to on the destination host.</param>
        /// <param name="timeout">Timeout duration for the Connect attempt.</param>
        /// <returns>
        /// Returns an open TcpClient object that can be used normally to communicate
        /// with the destination server
        /// </returns>
        /// <remarks>
        /// This method creates a connection to the proxy server and instructs the proxy server
        /// to make a pass through connection to the specified destination host on the specified
        /// port.
        /// </remarks>
        public TcpClient CreateConnection(string destinationHost, int destinationPort, TimeSpan timeout)
        {
            try
            {
                // if we have no connection, create one
                if (TcpClient == null)
                {
                    if (string.IsNullOrEmpty(ProxyHost))
                    {
                        throw new ProxyException("ProxyHost property must contain a value");
                    }

                    if (ProxyPort <= 0 || ProxyPort > 65535)
                    {
                        throw new ProxyException("ProxyPort value must be greater than zero and less than 65535");
                    }

                    if (ProxyHost.Contains("://"))
                    {
                        throw new ProxyException("The proxy's hostname cannot contain a protocol prefix (eg http://)");
                    }


                    //  create new tcp client object to the proxy server
                    TcpClient = tcpClientFactory();

                    // attempt to open the connection
                    log.Write(EventType.Diagnostic, "Connecting to proxy at {0}:{1}", ProxyHost, ProxyPort);
                    TcpClient.ConnectWithTimeout(ProxyHost, ProxyPort, timeout);
                }

                //  send connection command to proxy host for the specified destination host and port
                SendConnectionCommand(destinationHost, destinationPort);

                // return the open proxied tcp client object to the caller for normal use
                return(TcpClient);
            }
            catch (AggregateException ae)
            {
                var se = ae.InnerExceptions.OfType <SocketException>().FirstOrDefault();
                if (se != null)
                {
                    throw new ProxyException($"Connection to proxy host {ProxyHost} on port {ProxyPort} failed: {se.Message}", se);
                }

                throw;
            }
            catch (SocketException ex)
            {
                throw new ProxyException($"Connection to proxy host {ProxyHost} on port {ProxyPort} failed: {ex.Message}", ex);
            }
        }
예제 #14
0
        public static void Main(string[] args)
        {
            using (var fs1 = new FloatingStream())
                using (var fs2 = new FloatingStream())
                    using (var mux1 = new MultiplexStream(fs1, fs2))
                        using (var mux2 = new MultiplexStream(fs2, fs1))
                        {
                            var server = new ProxyHost(mux1, new ServiceCollection().BuildServiceProvider());

                            Task.Run(async() =>
                            {
                                var client = new ProxyHost(mux2, new ServiceCollection().BuildServiceProvider());

                                var valueProxy = new Proxy <Value>(new Value(12), ownsInstance: true);
                                var barProxy   = await client.CreateAsync <Bar>(cancellation: default);
예제 #15
0
        /// <summary>
        /// Returns true if ComDayCommonsHttpclientProperties instances are equal
        /// </summary>
        /// <param name="other">Instance of ComDayCommonsHttpclientProperties to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(ComDayCommonsHttpclientProperties other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     ProxyEnabled == other.ProxyEnabled ||
                     ProxyEnabled != null &&
                     ProxyEnabled.Equals(other.ProxyEnabled)
                     ) &&
                 (
                     ProxyHost == other.ProxyHost ||
                     ProxyHost != null &&
                     ProxyHost.Equals(other.ProxyHost)
                 ) &&
                 (
                     ProxyUser == other.ProxyUser ||
                     ProxyUser != null &&
                     ProxyUser.Equals(other.ProxyUser)
                 ) &&
                 (
                     ProxyPassword == other.ProxyPassword ||
                     ProxyPassword != null &&
                     ProxyPassword.Equals(other.ProxyPassword)
                 ) &&
                 (
                     ProxyNtlmHost == other.ProxyNtlmHost ||
                     ProxyNtlmHost != null &&
                     ProxyNtlmHost.Equals(other.ProxyNtlmHost)
                 ) &&
                 (
                     ProxyNtlmDomain == other.ProxyNtlmDomain ||
                     ProxyNtlmDomain != null &&
                     ProxyNtlmDomain.Equals(other.ProxyNtlmDomain)
                 ) &&
                 (
                     ProxyExceptions == other.ProxyExceptions ||
                     ProxyExceptions != null &&
                     ProxyExceptions.Equals(other.ProxyExceptions)
                 ));
        }
예제 #16
0
        public virtual IWebProxy GetProxy()
        {
            if (!UseProxy)
            {
                return(null);
            }
            if (String.IsNullOrEmpty(ProxyHost) || ProxyPort.GetValueOrDefault() <= 0)
            {
                return(null);
            }
            var proxy = new WebProxy(ProxyHost?.Trim(), ProxyPort.GetValueOrDefault());

            if (!String.IsNullOrEmpty(ProxyUserName))
            {
                proxy.Credentials = new NetworkCredential(ProxyUserName?.Trim(), ProxyPassword?.Trim());
            }
            return(proxy);
        }
예제 #17
0
        public WebProxy GetWebProxy()
        {
            WebProxy webProxy = null;

            if (!string.IsNullOrEmpty(ProxyHost) && ProxyPort > 0)
            {
                webProxy = new WebProxy(ProxyHost.StartsWith("http://", StringComparison.OrdinalIgnoreCase) ? ProxyHost.Substring("http://".Length) : ProxyHost, ProxyPort);
                if (ProxyCredentials != null)
                {
                    webProxy.Credentials = ProxyCredentials;
                }
                if (ProxyBypassList != null)
                {
                    webProxy.BypassList = ProxyBypassList.ToArray();
                }
                webProxy.BypassProxyOnLocal = ProxyBypassOnLocal;
            }
            return(webProxy);
        }
예제 #18
0
        private async Task <IProxy <LogicalEndPointSkeleton> > CreateProxyAsync(CancellationToken cancellation)
        {
            ProxyHost proxyHost = null;
            IProxy <LogicalEndPointSkeleton> proxy;

            try
            {
                proxyHost = await _debugConnection.GetProxyHostAsync(cancellation);

                proxy = await proxyHost.CreateAsync <LogicalEndPointSkeleton>(new object[] { EndPoint }, cancellation);
            }
            catch (OperationCanceledException)
            {
                proxyHost?.Dispose();
                throw;
            }

            return(proxy);
        }
        private async Task <IProxy <CoordinationManagerSkeleton> > CreateProxyAsync(CancellationToken cancellation)
        {
            ProxyHost proxyHost = null;
            IProxy <CoordinationManagerSkeleton> proxy;

            try
            {
                proxyHost = await _debugConnection.GetProxyHostAsync(cancellation);

                proxy = await proxyHost.CreateAsync <CoordinationManagerSkeleton>(cancellation);
            }
            catch (OperationCanceledException)
            {
                proxyHost?.Dispose();
                throw;
            }

            return(proxy);
        }
예제 #20
0
        /// <summary>
        /// Returns true if OrgApacheHttpProxyconfiguratorProperties instances are equal
        /// </summary>
        /// <param name="other">Instance of OrgApacheHttpProxyconfiguratorProperties to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(OrgApacheHttpProxyconfiguratorProperties other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     ProxyEnabled == other.ProxyEnabled ||
                     ProxyEnabled != null &&
                     ProxyEnabled.Equals(other.ProxyEnabled)
                     ) &&
                 (
                     ProxyHost == other.ProxyHost ||
                     ProxyHost != null &&
                     ProxyHost.Equals(other.ProxyHost)
                 ) &&
                 (
                     ProxyPort == other.ProxyPort ||
                     ProxyPort != null &&
                     ProxyPort.Equals(other.ProxyPort)
                 ) &&
                 (
                     ProxyUser == other.ProxyUser ||
                     ProxyUser != null &&
                     ProxyUser.Equals(other.ProxyUser)
                 ) &&
                 (
                     ProxyPassword == other.ProxyPassword ||
                     ProxyPassword != null &&
                     ProxyPassword.Equals(other.ProxyPassword)
                 ) &&
                 (
                     ProxyExceptions == other.ProxyExceptions ||
                     ProxyExceptions != null &&
                     ProxyExceptions.Equals(other.ProxyExceptions)
                 ));
        }
        private async Task ExecuteWithTimeout(NativeActivityContext context, CancellationToken cancellationToken = default)
        {
            var sshPassword   = new NetworkCredential("", Password.Get(context)).Password;
            var proxyPassword = new NetworkCredential("", ProxyPassword.Get(context)).Password;
            var sshTimeout    = TimeSpan.FromMilliseconds(SSHTimeoutMS.Get(context));

            ConnectionInfo connectionInfo;

            if (!string.IsNullOrEmpty(ProxyHost.Get(context)))         // Proxy defined
            {
                if (!string.IsNullOrEmpty(ProxyUsername.Get(context))) // Proxy authentication
                {
                    connectionInfo = new PasswordConnectionInfo(Host.Get(context), Port.Get(context), Username.Get(context), Encoding.UTF8.GetBytes(sshPassword), ProxyTypes.Http, ProxyHost.Get(context), ProxyPort.Get(context), ProxyUsername.Get(context), proxyPassword);
                }
                else // No proxy authentication
                {
                    connectionInfo = new PasswordConnectionInfo(Host.Get(context), Port.Get(context), Username.Get(context), sshPassword, ProxyTypes.Http, ProxyHost.Get(context), ProxyPort.Get(context));
                }
            }
            else // No Proxy defined
            {
                connectionInfo = new PasswordConnectionInfo(Host.Get(context), Port.Get(context), Username.Get(context), sshPassword);
            }

            connectionInfo.Timeout = sshTimeout;

            sshClient = new SshClient(connectionInfo);
            sshClient.Connect();

            if (ShellExpectedPrompt.Expression != null)
            {
                var terminalMode = new Dictionary <TerminalModes, uint>
                {
                    { TerminalModes.ECHO, 53 }
                };

                expectedPromptRegex = new Regex(ShellExpectedPrompt.Get(context), RegexOptions.Compiled);
                currentShellStream  = sshClient.CreateShellStream("UiPathTeam.SSHConnector.Shell", 0, 0, 0, 0, 4096, terminalMode);
                var welcomeMessage = SSHHelpers.Expect(currentShellStream, expectedPromptRegex, string.Empty, sshTimeout);
                ShellWelcomeMessage.Set(context, welcomeMessage);
            }
        }
        protected override async Task <Action <NativeActivityContext> > ExecuteAsync(NativeActivityContext context, CancellationToken cancellationToken)
        {
            // Inputs
            var activityTimeout     = TimeoutMS.Get(context);
            var host                = Host.Get(context);
            var port                = Port.Get(context);
            var username            = Username.Get(context);
            var password            = Password.Get(context);
            var shellExpectedPrompt = ShellExpectedPrompt.Get(context);
            var proxyHost           = ProxyHost.Get(context);
            var proxyPort           = ProxyPort.Get(context);
            var proxyUsername       = ProxyUsername.Get(context);
            var proxyPassword       = ProxyPassword.Get(context);

            // Set a timeout on the execution
            var task = ExecuteWithTimeout(context, cancellationToken);

            if (await Task.WhenAny(task, Task.Delay(activityTimeout, cancellationToken)) != task)
            {
                throw new TimeoutException(Resources.Timeout_Error);
            }

            if (task.Exception != null)
            {
                throw task.Exception;
            }

            _objectContainer.Add(sshClient);
            _objectContainer.Add(currentShellStream);
            _objectContainer.Add(expectedPromptRegex);

            return((ctx) => {
                // Schedule child activities
                if (Body != null)
                {
                    ctx.ScheduleAction <IObjectContainer>(Body, _objectContainer, OnCompleted, OnFaulted);
                }
            });
        }
예제 #23
0
 public AutomaController(ILogger <AutomaController> logger, ProxyHost proxyHost)
 {
     _logger    = logger;
     _proxyHost = proxyHost;
 }
예제 #24
0
        static Proxy()
        {
            var remoteType = typeof(TRemote);

            ProxyHost.AddLoadedRemoteType(remoteType);
        }
예제 #25
0
        private void SetupFilesystem()
        {
            Debug.WriteLine("SetupFilesystem {0},{1},{2},{3}", Host, Port, Username, ConnectionType.ToString());

            ProxyTypes pt = ProxyTypes.None;

            switch (ProxyType)
            {
            case 1: pt = ProxyTypes.Http; break;

            case 2: pt = ProxyTypes.Socks4; break;

            case 3: pt = ProxyTypes.Socks5; break;
            }
            int ProxyPort = 8080;
            var Proxy     = ProxyHost;

            if (ProxyHost != null)
            {
                var s = ProxyHost.Split(':');
                if (s.Length > 1)
                {
                    Int32.TryParse(s[1], out ProxyPort);
                    Proxy = s[0];
                }
            }

            ConnectionInfo info;

            switch (ConnectionType)
            {
            case ConnectionType.Pageant:
                var agent = new PageantProtocol();
                if (pt == ProxyTypes.None)
                {
                    info = new AgentConnectionInfo(Host, Port, Username, agent);
                }
                else if (ProxyUser.Length > 0)
                {
                    info = new AgentConnectionInfo(Host, Port, Username, pt, Proxy, ProxyPort, ProxyUser, ProxyPass, agent);
                }
                else
                {
                    info = new AgentConnectionInfo(Host, Port, Username, pt, Proxy, ProxyPort, agent);
                }
                break;

            case ConnectionType.PrivateKey:
                if (pt == ProxyTypes.None)
                {
                    info = new PrivateKeyConnectionInfo(Host, Port, Username, new PrivateKeyFile(PrivateKey, Passphrase));
                }
                else if (ProxyUser.Length > 0)
                {
                    info = new PrivateKeyConnectionInfo(Host, Port, Username, pt, Proxy, ProxyPort, ProxyUser, ProxyPass, new PrivateKeyFile(PrivateKey, Passphrase));
                }
                else
                {
                    info = new PrivateKeyConnectionInfo(Host, Port, Username, pt, Proxy, ProxyPort, new PrivateKeyFile(PrivateKey, Passphrase));
                }
                break;

            default:
                if (pt == ProxyTypes.None)
                {
                    info = new PasswordConnectionInfo(Host, Port, Username, Password);
                }
                else if (ProxyUser.Length > 0)
                {
                    info = new PasswordConnectionInfo(Host, Username, Password, pt, Proxy, ProxyPort, ProxyUser, ProxyPass);
                }
                else
                {
                    info = new PasswordConnectionInfo(Host, Port, Username, Password, pt, Proxy, ProxyPort);
                }
                break;
            }

            _connection = Settings.Default.UseNetworkDrive ? String.Format("\\\\{0}\\{1}\\{2}", info.Host, Root, info.Username) : Name;

            _filesystem = new SftpFilesystem(info, Root, _connection, Settings.Default.UseOfflineAttribute, false, (int)Settings.Default.AttributeCacheTimeout, (int)Settings.Default.DirContentCacheTimeout);
            Debug.WriteLine("Connecting...");
            _filesystem.KeepAliveInterval = new TimeSpan(0, 0, 60);
            _filesystem.Connect();
        }
예제 #26
0
 public IFoo GetFooTransparent()
 {
     return(ProxyHost.CreateProxy(new Foo(), ownsInstance: true).Cast <IFoo>().AsTransparentProxy());
 }
예제 #27
0
 public IProxy <Foo> GetFoo()
 {
     return(ProxyHost.CreateProxy(new Foo(), ownsInstance: true));
 }
예제 #28
0
 void IProxyInternal.Register(ProxyHost host, int proxyId, Action unregisterAction)
 {
     Proxy.Register(host, proxyId, unregisterAction);
 }
예제 #29
0
        public string PostHost([FromBody] dynamic id)
        {
            //ObservableCollection<Dictionary<string, object>> detailcollection = new ObservableCollection<Dictionary<string, object>>();
            //Dictionary<string, object> InvoiceStatus = new Dictionary<string, object>();
            string InvoiceId = string.Empty;

            try
            {
                ObservableCollection <IDictionary <string, object> > obj = JsonConvert.DeserializeObject <ObservableCollection <IDictionary <string, object> > >(Convert.ToString(id));
                string Status = string.Empty;
                foreach (Dictionary <string, object> header in obj)
                {
                    //Status = header["Status"].ToString();
                    prxyhost = JsonConvert.DeserializeObject <ProxyHost>(Convert.ToString(header["hostHeader"].ToString()));


                    //Invoicedetail = JsonConvert.DeserializeObject<List<ProxyInvoiceDetails>>(Convert.ToString(header["SalesDetail"].ToString()));
                }
                TblHost tblhost = new TblHost();
                var     rechost = (from rec in _TripstarContext.TblHost where rec.HostId == prxyhost.HostID && rec.UserId == prxyhost.UserID select rec).FirstOrDefault();
                if (rechost == null)
                {
                    var places = (from rec in _TripstarContext.TblPlaces where rec.Place == prxyhost.Place select rec).FirstOrDefault();
                    if (places != null)
                    {
                        tblhost.PlaceId = places.PlaceId;
                    }
                    //tblhost.Photo = prxyhost.photo;
                    if (prxyhost.photo != null)
                    {
                        prxyhost.photo = prxyhost.photo.Replace("data:image/png;base64,", "");
                        byte[] data1 = Convert.FromBase64String(prxyhost.photo.Replace("data:image/jpeg;base64,", ""));
                        tblhost.Photo = data1;
                    }
                    else
                    {
                        tblhost.Photo = null;
                    }
                    tblhost.Price       = Convert.ToDecimal(prxyhost.Price);
                    tblhost.Roomtype    = prxyhost.Roomtype;
                    tblhost.UserId      = Convert.ToInt32(prxyhost.UserID);
                    tblhost.Description = prxyhost.Description;
                    tblhost.Type        = prxyhost.Type;
                    //tbluser.password
                    _TripstarContext.Add(tblhost);
                }
                else
                {
                    TblHost tblhostupdate = (from rec in _TripstarContext.TblHost where rec.HostId == prxyhost.HostID && rec.UserId == prxyhost.UserID select rec).FirstOrDefault();
                    tblhostupdate.Review = prxyhost.Review;
                }

                _TripstarContext.SaveChanges();

                //return _repository.PostInvoice(Status, Headerdata, Invoicedetail);
                return("true");
            }
            catch (Exception ex)
            {
                return("false");
            }
        }