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); }
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); }
public ActionInfo <object> Hello() { return(ActionInfo <object> .EmptyResult("Hello, my friend")); }