Exemplo n.º 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 CreateSimAndDeviceAuthenticationSuccessLog(SimAndDevice simAndDevice)
        {
            var simAndDeviceAuthenticationSuccessLog = new SimAndDeviceAuthenticationSuccessLog
            {
                SimAndDevice = simAndDevice,
                Time         = DateTime.Now,
                Sim          = simAndDevice.Sim
            };

            _authenticationRepository.Create(simAndDeviceAuthenticationSuccessLog);
        }