コード例 #1
0
ファイル: CardStorage.cs プロジェクト: fathurxzz/aleqx
        public bool ValidatePin(int cardId, string cardPin, out Card card)
        {
            card = _context.Card.First(c => c.Id == cardId);
            if (card.Pin != cardPin)
            {
                card.PinAttemptsCount++;
                if (card.PinAttemptsCount >= 3)
                {
                    card.Locked = true;
                }
                _context.SaveChanges();
                return false;
            }

            if (card.PinAttemptsCount > 0)
            {
                card.PinAttemptsCount = 0;
                _context.SaveChanges();
            }
            return true;
        }
コード例 #2
0
ファイル: Model.Designer.cs プロジェクト: fathurxzz/aleqx
 /// <summary>
 /// Create a new Card object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="number">Initial value of the Number property.</param>
 /// <param name="locked">Initial value of the Locked property.</param>
 /// <param name="balance">Initial value of the Balance property.</param>
 /// <param name="pin">Initial value of the Pin property.</param>
 /// <param name="pinAttemptsCount">Initial value of the PinAttemptsCount property.</param>
 public static Card CreateCard(global::System.Int32 id, global::System.String number, global::System.Boolean locked, global::System.Decimal balance, global::System.String pin, global::System.Int32 pinAttemptsCount)
 {
     Card card = new Card();
     card.Id = id;
     card.Number = number;
     card.Locked = locked;
     card.Balance = balance;
     card.Pin = pin;
     card.PinAttemptsCount = pinAttemptsCount;
     return card;
 }
コード例 #3
0
ファイル: CardStorage.cs プロジェクト: fathurxzz/aleqx
 public void AddOperation(Card card, Operation operation)
 {
     throw new NotImplementedException();
 }
コード例 #4
0
ファイル: Model.Designer.cs プロジェクト: fathurxzz/aleqx
 /// <summary>
 /// Deprecated Method for adding a new object to the Card EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToCard(Card card)
 {
     base.AddObject("Card", card);
 }