コード例 #1
0
ファイル: BaseApiController.cs プロジェクト: gangbs/Framework
        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);
        }
コード例 #2
0
ファイル: BaseApiController.cs プロジェクト: gangbs/Framework
        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);
        }