public object Get(GetOrdersRequest request)
        {
            //alternatively
            //base.Response.ContentType = ContentType.Json;

            //value = json
            var pageQueryStringValue = this.Request.QueryString["page"];

            //value = application/json
            var acceptHeaderValue = this.Request.Headers["Accept"];

            //value = GET
            var httpMethod = this.Request.HttpMethod;

            //Setting up the response.
            this.Response.ContentType = ContentType.Json;
            //Response represents the object that the client will eventually receive.
            //Among others,one of the most useful methods exposed by the Response object is the AddHeader method,
            //which manipulates the headers returned to the clint.
            this.Response.AddHeader("Location", "http://<servername>/orders");
            return(new HttpResult {
                StatusCode = HttpStatusCode.OK
            });
            //Returning a decorated response via HttpResult.
            //return new HttpResult(resonseDTO, ContentType.Json);
        }
Example #2
0
        public object Get(GetOrdersRequest request)
        {
            //value = json
            var pageQueryStringValue = this.Request.QueryString["page"];

            //value = application/json
            var acceptHeaderValue = this.Request.Headers["Accept"];

            //value = GET
            var httpMethod = this.Request.HttpMethod;

            //Setting up the response.
            this.Response.ContentType = ContentType.Json;
            this.Response.AddHeader("Location", "http://<servername>/orders");
            return(new HttpResult {
                StatusCode = HttpStatusCode.OK
            });
        }