示例#1
0
         public AuthenticationLogDto(AuthenticationLog log)
         {
             Id           = log.Id;
             Type         = (TypeKey)Enum.Parse(typeof(TypeKey), log.GetType().ShortDisplayName());
             Time         = log.Time;
             Sim          = log.Sim;
             SimAndDevice = log switch
             {
                 SimAndDeviceAuthenticationSuccessLog a => a.SimAndDevice,
                 SimAndDeviceAuthenticationFailureLog _ => null,
                 MultiFactorAuthenticationSuccessLog _ => null,
                 MultiFactorAuthenticationFailureLog a => a.SimAndDevice,
                 DeauthenticationLog _ => null,
                                                      _ => null
             };
             MultiFactor = log switch
             {
                 SimAndDeviceAuthenticationSuccessLog _ => null,
                 SimAndDeviceAuthenticationFailureLog _ => null,
                 MultiFactorAuthenticationSuccessLog a => a.MultiFactor,
                 MultiFactorAuthenticationFailureLog _ => null,
                 DeauthenticationLog a => a.MultiFactor,
                                                      _ => null
             };
         }
     }
 }
        private void CreateSimAndDeviceAuthenticationFailureLog(Sim sim)
        {
            var simAndDeviceAuthenticationFailureLog = new SimAndDeviceAuthenticationFailureLog()
            {
                Sim  = sim,
                Time = DateTime.Now
            };

            _authenticationRepository.Create(simAndDeviceAuthenticationFailureLog);
        }