示例#1
0
        public async Task <IActionResult> AddOrEditPayPal([Bind("Name,Email,Password")] PaypalAccount paypal, string Id)
        {
            paypal.UserId = Int32.Parse(AuthUserId);
            if (!ModelState.IsValid)
            {
                return(PartialView("Views/Forms/AddOrEditPayPal.cshtml", paypal));
            }
            paypal.Compromised = PwnedPasswords.IsPasswordPwnedAsync(paypal.Password, new CancellationToken(), null).Result == -1 ? 0 : 1;
            paypal.Password    = _encryptionService.Encrypt(AuthUserId, paypal.Password);


            if (!Id.Equals("0"))
            {
                paypal.Id = Int32.Parse(dataProtectionHelper.Decrypt(Id, "QueryStringsEncryptions"));
            }

            if (paypal.Id == 0)
            {
                await _apiService.CreateUpdateData <PaypalAccount>(paypal);
            }
            else
            {
                await _apiService.CreateUpdateData <PaypalAccount>(paypal, paypal.Id);
            }
            ClearCache();


            return(RedirectToAction("List"));
        }
示例#2
0
 private PaypalAccount DecryptModelPay(PaypalAccount model)
 {
     return(new PaypalAccount
     {
         Name = model.Name,
         Email = model.Email,
         Password = _encryptionService.Decrypt(AuthUserId, model.Password)
     });
 }
 public AccountsHelper(BankAccountHelper bank, PaypalAccount paypal)
 {
     this.bank   = bank;
     this.paypal = paypal;
 }