예제 #1
0
 /// <summary>
 /// 记录访问日志
 /// </summary>
 /// <param name="filterContext"></param>
 /// <param name="userInfo"></param>
 protected static async Task AddActionLogAsync(ActionExecutingContext filterContext, UserInfo userInfo)
 {
     await Task.Run(() =>
     {
         //忽略系统请求
         if (!IsAutoRequestIgnore(filterContext.Controller, filterContext.ActionDescriptor))
         {
             var loginfo = InitAdminLogInfo(filterContext, userInfo);
             Log.Info(JsonConvert.SerializeObject(loginfo));
             //插入log
             AdminLogs.AddAdminLog(loginfo);
         }
     });
 }
예제 #2
0
        public JsonResult Add(AdminLogVModel model)
        {
            var result = new JsonResultModel();

            if (ModelState.IsValid)
            {
                //add
                result.ResultState = AdminLogs.AddAdminLog(AdminLogs.AdminLogVModelToInfo(model)) > 0;
            }
            else
            {
                result.ResultState = false;
                result.Message     = ModelStateHelper.GetAllErrorMessage(ModelState);
            }

            return(Json(result));
        }