private void Close(Otp otp) { otp.Status = 2; otp.ConsumptionTime = DateTime.Now; Context.Otp.Update(otp); Context.SaveChanges(); }
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); }
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); }
private void SendOTPToAccount(Account userAccount, Otp generatedOTP) { return; }