Exemplo n.º 1
0
        private void GetHostname(IHostNameProcessor hostnameProcessor)
        {
            Get["/hostname{fullyQualified}"] = parameters =>
            {
                try
                {
                    var fullyQualifiedQuery = this.Bind <fullyQualifiedModel>();
                    var hostname            = hostnameProcessor.GetHostName();
                    if (fullyQualifiedQuery.fullyQualified)
                    {
                        hostname = hostnameProcessor.GetFullyQualifiedHostName();
                    }

                    var HostNameOutput = new MachineInformationResults
                    {
                        result = hostname
                    };
                    return(Response.AsJson(HostNameOutput));
                }
                catch (Exception e)
                {
                    return(HttpStatusCode.InternalServerError);
                }
            };
        }
Exemplo n.º 2
0
        private void GetHostname(IHostNameProcessor hostnameProcessor)
        {
            Get["/hostname{fullyQualified}"] = parameters =>
            {
                var fullyQualifiedQuery = this.Bind <fullyQualifiedModel>();
                var hostname            = hostnameProcessor.GetHostName();
                if (fullyQualifiedQuery.fullyQualified)
                {
                    hostname = hostnameProcessor.GetFullyQualifiedHostName();
                }

                var HostNameOutput = new MachineInformationResults
                {
                    output = hostname
                };
                return(Response.AsJson(HostNameOutput));
            };
        }