Ejemplo n.º 1
0
        public void WriteGeneralLog(long accountId, string ipAddress, long?characterId, GeneralLogType logType, string logData)
        {
            try
            {
                using (var context = DataAccessHelper.CreateContext())
                {
                    GeneralLog log = new GeneralLog
                    {
                        AccountId   = accountId,
                        IpAddress   = ipAddress,
                        Timestamp   = DateTime.Now,
                        LogType     = logType.ToString(),
                        LogData     = logData,
                        CharacterId = characterId
                    };

                    context.GeneralLog.Add(log);
                    context.SaveChanges();
                }
            }
            catch (Exception e)
            {
                Logger.Error(e);
            }
        }
Ejemplo n.º 2
0
 public GeneralLogDTO Insert(GeneralLogDTO generallog)
 {
     try
     {
         using (var context = DataAccessHelper.CreateContext())
         {
             GeneralLog entity = _mapper.Map <GeneralLog>(generallog);
             context.GeneralLog.Add(entity);
             context.SaveChanges();
             return(_mapper.Map <GeneralLogDTO>(generallog));
         }
     }
     catch (Exception e)
     {
         Logger.Error(e);
         return(null);
     }
 }