예제 #1
0
        public async Task <IActionResult> GetPhoneCode(PhoneDto phoneDto)
        {
            Random random    = new Random();
            int    sayi      = random.Next(100000, 999999);
            var    phoneCode = new PhoneNumberCode()
            {
                PhoneNumber = phoneDto.PhoneNumber,
                Code        = sayi
            };

            PhoneService.Send(phoneDto.PhoneNumber, sayi);
            _authRepo.Add(phoneCode);
            if (await _authRepo.SaveAll())
            {
                return(Ok());
            }
            return(BadRequest("Failed to send the code"));
        }