diff --git a/Back/Controllers/VerificationController.cs b/Back/Controllers/VerificationController.cs index d19b02a..f8e4a68 100644 --- a/Back/Controllers/VerificationController.cs +++ b/Back/Controllers/VerificationController.cs @@ -30,7 +30,7 @@ namespace Back.Controllers return Ok(new VerificationCodeDto { ID = ID, - Code="", + Code=0, prm= _getVerificationValidation.verificationCode.prm, Type= _getVerificationValidation.verificationCode.Type, val= _getVerificationValidation.verificationCode.val diff --git a/Shared/DTOs/VerificationCodeDto.cs b/Shared/DTOs/VerificationCodeDto.cs index c20fb18..b21df01 100644 --- a/Shared/DTOs/VerificationCodeDto.cs +++ b/Shared/DTOs/VerificationCodeDto.cs @@ -9,15 +9,14 @@ namespace Shared.DTOs { public class VerificationCodeDto { - [Required(ErrorMessage ="ID نمیتواند خالی باشد")] + // [Required(ErrorMessage ="ID نمیتواند خالی باشد")] public int ID { get; set; } - [Required(ErrorMessage = "کد نمیتواند خالی باشد")] - public string Code { get; set; } - [Required(ErrorMessage = "prm نمیتواند خالی باشد")] + public int Code { get; set; } + // [Required(ErrorMessage = "prm نمیتواند خالی باشد")] public string prm { get; set; } - [Required(ErrorMessage = "val نمیتواند خالی باشد")] + // [Required(ErrorMessage = "val نمیتواند خالی باشد")] public string val { get; set; } - [Required(ErrorMessage = "Type نمیتواند خالی باشد")] + // [Required(ErrorMessage = "Type نمیتواند خالی باشد")] public string Type { get; set; } } } diff --git a/TaxPayerFull/Pages/Verification.razor b/TaxPayerFull/Pages/Verification.razor index e976143..38273cd 100644 --- a/TaxPayerFull/Pages/Verification.razor +++ b/TaxPayerFull/Pages/Verification.razor @@ -46,18 +46,16 @@ - +
+ - - - - +
- + کد تائید
@@ -65,16 +63,13 @@
-
- - - - - - -
+ - +
+ +
کد ارسال نشد؟ ارسال مجدد
@@ -89,11 +84,11 @@ @code { private EditContext? editContext; private ValidationMessageStore? messageStore; - + public string Error{ get; set; } [Parameter] public int ID { get; set; } - // [SupplyParameterFromForm] + [SupplyParameterFromForm] public VerificationCodeDto? VerificationCodeModel { get; set; } = new VerificationCodeDto(); protected override void OnInitialized() { @@ -109,7 +104,6 @@ { VerificationCodeModel = await request.Content.ReadFromJsonAsync(); - // nav.NavigateTo($"Verification/{res}"); } else { @@ -123,24 +117,34 @@ private async Task SubmitVerificationCode() { - var request = await _hc.PostAsJsonAsync($"Verification/Submit", VerificationCodeModel); - if (request.IsSuccessStatusCode) + Error = ""; + if (VerificationCodeModel.Code < 1000 || VerificationCodeModel.Code > 9000) { - - var status = await request.Content.ReadFromJsonAsync(); - if (status) - { - - } - else - { - - } - // nav.NavigateTo($"Verification/{res}"); + Error = "کد احراز صحیح نمی باشد"; } else { - nav.NavigateTo($"/"); + var request = await _hc.PostAsJsonAsync($"Verification/Submit", VerificationCodeModel); + if (request.IsSuccessStatusCode) + { + var status = await request.Content.ReadFromJsonAsync(); + if (status) + { + + } + else + { + + } + + + // nav.NavigateTo($"Verification/{res}"); + } + else + { + nav.NavigateTo($"/"); + } } + } }