示例#1
0
 public Task <int> WriteDbLog(LogEntity logEntity, HttpContext context)
 {
     logEntity.Id            = Common.GuId();
     logEntity.Date          = DateTime.Now;
     logEntity.IPAddress     = "117.81.192.182";
     logEntity.IPAddressName = Net.GetLocation(logEntity.IPAddress);
     logEntity.AttachCreateInfo(context);
     return(service.InsertAsync(logEntity));
 }
示例#2
0
        public Task <int> WriteDbLog(bool result, string resultLog, HttpContext context)
        {
            var userCode = context.User.Claims.First(t => t.Type == OperatorModelClaimNames.UserCode).Value;
            var userName = context.User.Claims.First(t => t.Type == OperatorModelClaimNames.UserName).Value;

            LogEntity logEntity = new LogEntity();

            logEntity.Id       = Common.GuId();
            logEntity.Date     = DateTime.Now;
            logEntity.Account  = userCode;
            logEntity.NickName = userName;
            //logEntityIPAddress = Net.Ip;
            logEntity.IPAddress     = Net.GetIp(context);
            logEntity.IPAddressName = Net.GetLocation(logEntity.IPAddress);
            logEntity.Result        = result;
            logEntity.Description   = resultLog;
            logEntity.AttachCreateInfo(context);
            return(service.InsertAsync(logEntity));
        }