Пример #1
0
 private void Close(Otp otp)
 {
     otp.Status          = 2;
     otp.ConsumptionTime = DateTime.Now;
     Context.Otp.Update(otp);
     Context.SaveChanges();
 }
Пример #2
0
        public int GenerateOTP()
        {
            string   OTPCode      = GenerateRandomString();
            int      Status       = 1;
            DateTime CreationTime = DateTime.Now;
            Otp      GeneratedOTP = new Otp()
            {
                Code = OTPCode, Status = Status, CreationTime = CreationTime
            };

            Context.Otp.Add(GeneratedOTP);
            Context.SaveChanges();
            return(GeneratedOTP.Id);
        }
Пример #3
0
        public Account ValidateCorrectCredentials(string Msisdn, string Password)
        {
            var UserAccount = Context.Account.Where(Acc => Acc.Msisdn == Msisdn && Acc.Password == Password).FirstOrDefault();

            if (UserAccount != null)
            {
                OTPRep oTPRep         = new OTPRep(Context);
                Otp    GeneratedOTP   = oTPRep.GenerateOTP();
                int    GeneratedOTPID = GeneratedOTP.Id;
                SendOTPToAccount(UserAccount, GeneratedOTP);
                UpdateLastOTp(UserAccount, GeneratedOTPID);
                return(UserAccount);
            }
            return(null);
        }
Пример #4
0
 private void SendOTPToAccount(Account userAccount, Otp generatedOTP)
 {
     return;
 }