Ejemplo n.º 1
0
        protected HttpResponseMessage CreateResponseMessage <T>(T data)
        {
            var response = new HttpResponseMessage(HttpStatusCode.OK);
            var back     = new HttpBackResult <T> {
                Status = (int)HttpBackCode.Success, Msg = HttpBackCode.Success.GetDescribeInfo(), Data = data
            };

            response.Content = new StringContent(back.ToJson());
            return(response);
        }
Ejemplo n.º 2
0
        protected HttpResponseMessage CreateResponseMessage <T>(HttpBackCode code, T data, string message = null)
        {
            var response = new HttpResponseMessage(HttpStatusCode.OK);
            var back     = new HttpBackResult <T> {
                Status = (int)code, Msg = message == null?code.GetDescribeInfo() : message, Data = data
            };

            response.Content = new StringContent(back.ToJson());
            return(response);
        }
Ejemplo n.º 3
0
        protected HttpResponseMessage CreateResponseMessage(HttpBackCode code)
        {
            var response = new HttpResponseMessage(HttpStatusCode.OK);
            var back     = new HttpBackResult <string> {
                Status = (int)code, Msg = code.GetDescribeInfo(), Data = null
            };

            response.Content = new StringContent(back.ToJson());
            return(response);
        }