diff --git a/Back/Back.csproj b/Back/Back.csproj index 38e11a4..ac6c0cd 100644 --- a/Back/Back.csproj +++ b/Back/Back.csproj @@ -34,7 +34,7 @@ - ..\..\..\LocalGit\TaxPayerTools\Service\bin\Debug\Service.dll + ..\..\Dlls\Service.dll diff --git a/Back/Controllers/VerificationController.cs b/Back/Controllers/VerificationController.cs index c05bc14..d19b02a 100644 --- a/Back/Controllers/VerificationController.cs +++ b/Back/Controllers/VerificationController.cs @@ -29,10 +29,18 @@ namespace Back.Controllers return BadRequest(resultValidationmodel.Errors.Select(s => s.ErrorMessage).ToList()); return Ok(new VerificationCodeDto { + ID = ID, + Code="", prm= _getVerificationValidation.verificationCode.prm, Type= _getVerificationValidation.verificationCode.Type, val= _getVerificationValidation.verificationCode.val - }); + });; + } + [HttpPost("Submit")] + [AllowAnonymous] + public async Task> Submit(VerificationCodeDto item) + { + return Ok(false); } } } diff --git a/Shared/DTOs/VerificationCodeDto.cs b/Shared/DTOs/VerificationCodeDto.cs index b6376d2..c20fb18 100644 --- a/Shared/DTOs/VerificationCodeDto.cs +++ b/Shared/DTOs/VerificationCodeDto.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -8,8 +9,15 @@ namespace Shared.DTOs { public class VerificationCodeDto { + [Required(ErrorMessage ="ID نمیتواند خالی باشد")] + public int ID { get; set; } + [Required(ErrorMessage = "کد نمیتواند خالی باشد")] + public string Code { get; set; } + [Required(ErrorMessage = "prm نمیتواند خالی باشد")] public string prm { get; set; } + [Required(ErrorMessage = "val نمیتواند خالی باشد")] public string val { get; set; } + [Required(ErrorMessage = "Type نمیتواند خالی باشد")] public string Type { get; set; } } } diff --git a/TaxPayerFull/Layout/TaxTools.razor b/TaxPayerFull/Layout/TaxTools.razor index 07bfc83..53d8869 100644 --- a/TaxPayerFull/Layout/TaxTools.razor +++ b/TaxPayerFull/Layout/TaxTools.razor @@ -118,6 +118,8 @@ editContext = new EditContext(modelTaxTools); messageStore = new(editContext); + + base.OnInitialized(); } // private void HandleValidationRequested(object? sender, diff --git a/TaxPayerFull/Pages/Verification.razor b/TaxPayerFull/Pages/Verification.razor index ec6a725..e976143 100644 --- a/TaxPayerFull/Pages/Verification.razor +++ b/TaxPayerFull/Pages/Verification.razor @@ -8,34 +8,30 @@ - + + + - - - - برای ادامه نیاز است هویت شما تائید شود - - - کد ارسالی را وارد نمایید - + + + + لطفا کد ارسالی را وارد نمایید + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - @@ -45,22 +41,40 @@ - - + + + + + + + + + + + + + - + کد تائید - احراز + احراز + + + + + + + + - - + کد ارسال نشد؟ ارسال مجدد @@ -73,21 +87,29 @@ @code { + private EditContext? editContext; + private ValidationMessageStore? messageStore; + [Parameter] public int ID { get; set; } - [SupplyParameterFromForm] - public int Code { get; set; } - - public VerificationCodeDto Model { get; set; } + // [SupplyParameterFromForm] + public VerificationCodeDto? VerificationCodeModel { get; set; } = new VerificationCodeDto(); + protected override void OnInitialized() + { + editContext = new EditContext(VerificationCodeModel); + messageStore = new(editContext); + base.OnInitialized(); + } + protected override async Task OnParametersSetAsync() { var request = await _hc.GetAsync($"Verification/GetVerification/{ID}"); if (request.IsSuccessStatusCode) { - - Model = await request.Content.ReadFromJsonAsync(); - // nav.NavigateTo($"Verification/{res}"); + + VerificationCodeModel = await request.Content.ReadFromJsonAsync(); + // nav.NavigateTo($"Verification/{res}"); } else { @@ -97,29 +119,28 @@ await base.OnParametersSetAsync(); } } -@functions{ + @functions { - private void Submit() - { - - } + private async Task SubmitVerificationCode() + { + 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($"/"); + } + } } - - - - - - - - - - - - - diff --git a/TaxPayerFull/Program.cs b/TaxPayerFull/Program.cs index 27ef188..44acca9 100644 --- a/TaxPayerFull/Program.cs +++ b/TaxPayerFull/Program.cs @@ -7,9 +7,9 @@ var builder = WebAssemblyHostBuilder.CreateDefault(args); builder.RootComponents.Add("#app"); builder.RootComponents.Add("head::after"); -//builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("https://localhost:7075/api/") }); +builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("https://localhost:7075/api/") }); -builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://localhost:5271/api/") }); +//builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://localhost:5271/api/") }); CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("fa-Ir");