Exemplo n.º 1
0
        public HttpResponseMessage RecvAPIData(ResponseObj obj)
        {
            HttpResponseMessage resp = new HttpResponseMessage();
            string        jsonString = new GenLib().ObjToJsonWithJsonNet(obj);
            StringContent sc         = new StringContent(jsonString);

            sc.Headers.ContentType = new MediaTypeHeaderValue("application/json");
            resp.Content           = sc;
            return(resp);
        }
Exemplo n.º 2
0
        public HttpResponseMessage WriteErrorLog(System.Exception ex)
        {
            ResponseObj obj    = new ResponseObj();
            GenLib      objLib = new GenLib();

            obj.Status  = 0;
            obj.Message = Convert.ToString("Error, try agian later!");
            string        jsonString = objLib.ObjToJsonWithJsonNet(obj);
            StringContent sc         = new StringContent(jsonString);

            sc.Headers.ContentType = new MediaTypeHeaderValue("application/json");
            HttpResponseMessage resp = new HttpResponseMessage();

            resp.Content = sc;
            return(resp);
        }