public void Apply(LoginResultResponse evn)
 {
     if (evn.IsSucceed)
     {
         this.MemberId = evn.MemberId;
         this.LastSuccessFullLoginAttempt = new LastSuccessFullLoginAttempt(DateTime.UtcNow);
     }
     else
     {
         this.MemberId = evn.MemberId;
         this.LastUnSuccessFullLoginAttempt = new LastUnSuccessFullLoginAttempt(DateTime.UtcNow);
     }
 }
Пример #2
0
 private bool Execute(ValidateCredentialCommand cmd)
 {
     // var credentialId = CredentialId.NewDeterministic(CredentialNamespace.Instance, $"{cmd.Username}{cmd.Password}");
     if (!string.IsNullOrEmpty(cmd.Username) &&
         !string.IsNullOrEmpty(cmd.Password) &&
         this.State.CredentialId == Id && this.State.MemberId != null)
     {
         var @event = new LoginResultResponse(true, this.State.MemberId);
         Sender.Tell(@event);
         return(true);
     }
     else
     {
         var @event = new LoginResultResponse(false, null);
         Sender.Tell(@event);
         return(false);
     }
 }