Esempio n. 1
0
        protected virtual ActionInfo <object> NoneQueryAction(object param, Func <ParamsValidHelper <object> > verify, Func <int> biz, Dictionary <int, string> msgDic)
        {
            if (param == null)
            {
                return(ParamsValidHelper <object> .PostParamNull);
            }
            var valid = verify();

            if (!valid.IsValid())
            {
                return(valid.ShowInValidMessage());
            }

            var result = ActionInfo <object> .EmptyResult();

            int code = biz();

            if (code != 0)
            {
                string message = GetMessage(msgDic, code);
                result.returncode = code;
                result.message    = message;
            }
            return(result);
        }
Esempio n. 2
0
        public override void OnException(HttpActionExecutedContext actionExecutedContext)
        {
            var expection = actionExecutedContext.Exception;

            log.Fatal(expection.Message, expection);

            var error = ActionInfo <object> .EmptyResult(expection.Message, (int)HttpStatusCode.InternalServerError);

            actionExecutedContext.Response = actionExecutedContext.Request.CreateResponse(HttpStatusCode.InternalServerError,
                                                                                          error);
            base.OnException(actionExecutedContext);
        }
Esempio n. 3
0
 public ActionInfo <object> Hello()
 {
     return(ActionInfo <object> .EmptyResult("Hello, my friend"));
 }