Esempio n. 1
0
        public async Task <bool> Retain(string cardNumber)
        {
            CardReaderService cr = new CardReaderService();
            var card             = cr.GetCard(cardNumber);

            if (await cr.RetainCardAsync(card))
            {
                return(true);
            }
            return(false);
        }
Esempio n. 2
0
 public async Task <JsonResult> Login(Card model)
 {
     if (ModelState.IsValid)
     {
         var membership = new WebConfigMembershipProvider();
         var cardReader = new CardReaderService();
         var card       = cardReader.GetCard(model.CardNumber);
         if (card.IsReported)
         {
             await cardReader.RetainCardAsync(card);
         }
         else if (membership.ValidateUser(model.CardNumber, model.Pin))
         {
             FormsAuthentication.SetAuthCookie(model.CardNumber, true);
             card.IsAuthenticated = true;
             return(Json(card, JsonRequestBehavior.AllowGet));
         }
     }
     return(Json(new Card(), JsonRequestBehavior.AllowGet));
 }