示例#1
0
        protected void CheckPinCodeInternal(CreditCard card, string pinCode)
        {
            string encripted = EncryptionService.Encrypt(pinCode, card.Salt);

            if (!card.PinCode.Equals(encripted))
                throw new WrongPinCodeException();
        }
示例#2
0
        public void CreateCreditCard(long ccNumber, string pinCode, double balance)
        {
            var cc = new CreditCard
            {
                Balance = balance,
                IsBlocked = false,
                CreditCardNumber = ccNumber,
                Salt = EncryptionService.GetSolt(),
            };

            cc.PinCode = EncryptionService.Encrypt(pinCode, cc.Salt);

            Context.CreditCards.Add(cc);
            Context.SaveChanges();
        }