Example #1
0
        public Negotiator SendData(ResponseType type)
        {
            ResponseModule res = new ResponseModule();

            res.status      = new Status();
            res.status.code = ((int)type).ToString();
            res.status.desc = EnumAttribute.GetDescription(type);
            return(Negotiate
                   .WithStatusCode(HttpStatusCode.OK)
                   .WithModel(res));
        }
Example #2
0
        public Negotiator SendData(ResponseType type, string msg)
        {
            ResponseModule res = new ResponseModule();

            res.status      = new Status();
            res.status.code = ((int)type).ToString();
            res.status.desc = msg;
            return(Negotiate
                   .WithStatusCode(HttpStatusCode.OK)
                   .WithModel(res));
        }
Example #3
0
        /// <summary>
        /// 响应数据
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="obj"></param>
        /// <param name="userid"></param>
        /// <param name="token"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public Negotiator SendData <T>(T obj, string userid, string token, ResponseType type) where T : class
        {
            JsonSettings.MaxJsonLength = Int32.MaxValue;
            ResponseModule <T> res = new ResponseModule <T>();

            res.status      = new Status();
            res.userid      = userid;
            res.status.code = ((int)type).ToString();
            res.status.desc = EnumAttribute.GetDescription(type);
            res.result      = obj;
            res.token       = token;
            return(Negotiate
                   .WithStatusCode(HttpStatusCode.OK)
                   .WithModel(res));
        }