Пример #1
0
 public async Task <UserAccountsEditUpdateCommand> Handle(UserAccountsEditUpdateCommand request, CancellationToken cancellationToken)
 {
     try
     {
         Accounts currentAccount = _repository.GetByID <Accounts>(request.Id);
         currentAccount.accountUsername        = request.AccountsUsername;
         currentAccount.accountPasswordEncrypt = _passwordEncrypt.EncryptPassword(Globals.encryptKeyGlobal, request.AccountPassword);
         currentAccount.accountWebsiteLink     = request.AccountWebsiteLink;
         _repository.Update <Accounts>(request.Id, currentAccount);
         request.isValid = true;
         return(request);
     }
     catch
     {
         request.isValid = false;
         return(request);
     }
 }
Пример #2
0
 public async Task <UserAccountsAddCommand> Handle(UserAccountsAddCommand request, CancellationToken cancellationToken)
 {
     try
     {
         _repository.Insert <Accounts>(new Accounts
         {
             accountUsername        = request.AccountsUsername,
             accountPasswordEncrypt = _passwordEncrypt.EncryptPassword(Globals.encryptKeyGlobal, request.AccountPassword),
             accountWebsiteLink     = request.AccountWebsiteLink,
             accountAppUser         = request.UserId
         });
         request.isValid = true;
         return(request);
     }
     catch (Exception err)
     {
         string eee = err.InnerException.ToString();
         request.isValid = false;
         return(request);
     }
 }