This commit is contained in:
mmrbnjd
2024-04-29 18:15:46 +03:30
parent 7b8127dc72
commit 319270d567
20 changed files with 356 additions and 96 deletions

View File

@@ -28,6 +28,10 @@ namespace Back.Services
}
public async Task<VerificationCode> GetVerificationCode(int ID)
{
return await _verificationCodeRepo.Get(w => w.Code == ID).FirstOrDefaultAsync();
}
public async Task<VerificationCode> GetVerificationCodeByID(int ID)
{
return await _verificationCodeRepo.Get(w => w.ID == ID).FirstOrDefaultAsync();
}
@@ -68,7 +72,7 @@ namespace Back.Services
public async Task<int> GenerateCode(VerificationCode code)
{
code.Code = Random.Shared.Next(1000, 9000);
while (await GetVerificationCode(code.ID) != null)
while (await GetVerificationCode(code.Code) != null)
code.Code = Random.Shared.Next(1000, 9000);