This commit is contained in:
mmrbnjd
2024-04-15 17:16:17 +03:30
parent 3f429e0539
commit 5f422bc11f
7 changed files with 148 additions and 59 deletions

View File

@@ -16,14 +16,14 @@ namespace Back.Services
return await _verificationCodeRepo.Get(w => w.prm == Prm).FirstOrDefaultAsync();
}
public async Task<VerificationCode> GetRegistrationCode(int ID)
public async Task<VerificationCode> GetVerificationCode(int ID)
{
return await _verificationCodeRepo.Get(w => w.ID == ID).FirstOrDefaultAsync();
}
public async Task<int> GenerateCode(VerificationCode code)
{
code.Code = Random.Shared.Next(1000, 9000);
while (await GetRegistrationCode(code.ID) != null)
while (await GetVerificationCode(code.ID) != null)
code.Code = Random.Shared.Next(1000, 9000);