...
This commit is contained in:
@@ -25,7 +25,6 @@
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Common\DTOs\" />
|
||||
<Folder Include="Features\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -34,7 +33,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="Service">
|
||||
<HintPath>..\..\Dlls\Service.dll</HintPath>
|
||||
<HintPath>..\..\..\LocalGit\TaxPayerTools\Service\bin\Debug\Service.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
|
@@ -12,11 +12,11 @@ namespace Back.Controllers
|
||||
[ApiController]
|
||||
public class VerificationController : ControllerBase
|
||||
{
|
||||
//private readonly ServValidatinMsg _servValidatinMsg;
|
||||
private readonly ServValidatinMsg _servValidatinMsg;
|
||||
private readonly GetVerificationValidation _getVerificationValidation;
|
||||
public VerificationController(/*ServValidatinMsg servValidatinMsg, */GetVerificationValidation getVerificationValidation)
|
||||
public VerificationController(ServValidatinMsg servValidatinMsg, GetVerificationValidation getVerificationValidation)
|
||||
{
|
||||
//_servValidatinMsg = servValidatinMsg;
|
||||
_servValidatinMsg = servValidatinMsg;
|
||||
_getVerificationValidation = getVerificationValidation;
|
||||
|
||||
}
|
||||
@@ -40,7 +40,27 @@ namespace Back.Controllers
|
||||
[AllowAnonymous]
|
||||
public async Task<ActionResult<bool>> Submit(VerificationCodeDto item)
|
||||
{
|
||||
return Ok(false);
|
||||
var VerificationCode= await _servValidatinMsg.GetVerificationCode(item.ID);
|
||||
if (VerificationCode==null)
|
||||
return NotFound("آیتمی یافت نشد");
|
||||
|
||||
if (VerificationCode.Code==item.Code)
|
||||
{
|
||||
if (VerificationCode.prm == item.prm && VerificationCode.val == item.val && VerificationCode.Type == item.Type)
|
||||
{
|
||||
switch (VerificationCode.Type)
|
||||
{
|
||||
case "NewTicketNoAuthentication":
|
||||
return Ok(_servValidatinMsg.SubmittedTicket(VerificationCode));
|
||||
default:
|
||||
return BadRequest("این نوع احراز تعریف نشده");
|
||||
}
|
||||
}
|
||||
else return BadRequest("اطلاعات شما منطبق با سامانه نیست");
|
||||
|
||||
}
|
||||
else return BadRequest("کد احراز صحیح نمی باشد");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -24,6 +24,9 @@ builder.Services.AddScoped<Service.Main>();
|
||||
builder.Services.AddScoped<servTicket > ();
|
||||
builder.Services.AddScoped < ServValidatinMsg>();
|
||||
builder.Services.AddScoped<GetVerificationValidation> ();
|
||||
builder.Services.AddScoped<GetVerificationValidation>();
|
||||
|
||||
|
||||
string origins = "OriginTaxPayer";
|
||||
builder.Services.AddCors(options =>
|
||||
{
|
||||
|
@@ -1,4 +1,5 @@
|
||||
using Back.Data.Contracts;
|
||||
using Back.Common.Enums;
|
||||
using Back.Data.Contracts;
|
||||
using Back.Data.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
@@ -7,9 +8,11 @@ namespace Back.Services
|
||||
public class ServValidatinMsg
|
||||
{
|
||||
private readonly IAsyncRepository<VerificationCode> _verificationCodeRepo;
|
||||
public ServValidatinMsg(IAsyncRepository<VerificationCode> verificationCodeRepo)
|
||||
private readonly IAsyncRepository<Ticket> _ticket;
|
||||
public ServValidatinMsg(IAsyncRepository<VerificationCode> verificationCodeRepo, IAsyncRepository<Ticket> ticket)
|
||||
{
|
||||
_verificationCodeRepo = verificationCodeRepo;
|
||||
_ticket = ticket;
|
||||
}
|
||||
public async Task<VerificationCode> GetCodeByPrm(string Prm)
|
||||
{
|
||||
@@ -20,6 +23,16 @@ namespace Back.Services
|
||||
{
|
||||
return await _verificationCodeRepo.Get(w => w.ID == ID).FirstOrDefaultAsync();
|
||||
}
|
||||
public async Task<bool> SubmittedTicket(VerificationCode code)
|
||||
{
|
||||
var ticket = await _ticket.Get(w => w.ID == Convert.ToInt32(code.prm)).FirstOrDefaultAsync();
|
||||
if (ticket != null)
|
||||
{
|
||||
ticket.Status = StatusTicket.Awaitingreview;
|
||||
return await _ticket.UpdateAsync(ticket);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public async Task<int> GenerateCode(VerificationCode code)
|
||||
{
|
||||
code.Code = Random.Shared.Next(1000, 9000);
|
||||
|
@@ -42,14 +42,9 @@
|
||||
|
||||
<div class="signin-banner-from-box">
|
||||
|
||||
<EditForm EditContext="editContext" OnValidSubmit="SubmitVerificationCode">
|
||||
|
||||
@* <EditForm EditContext="editContext" OnValidSubmit="SubmitVerificationCode"> *@
|
||||
|
||||
<DataAnnotationsValidator />
|
||||
<div class="postbox__comment-input mb-35">
|
||||
<ValidationMessage For="()=>VerificationCodeModel.Code" />
|
||||
|
||||
</div>
|
||||
<EditForm Model="VerificationCodeModel" OnSubmit="SubmitVerificationCode" FormName="VerificationCodeDto">
|
||||
|
||||
|
||||
<div class="row">
|
||||
@@ -66,6 +61,8 @@
|
||||
|
||||
</EditForm>
|
||||
<div class="row">
|
||||
|
||||
|
||||
<label style="color:red">
|
||||
@Error
|
||||
</label>
|
||||
@@ -82,20 +79,15 @@
|
||||
</main>
|
||||
|
||||
@code {
|
||||
private EditContext? editContext;
|
||||
private ValidationMessageStore? messageStore;
|
||||
|
||||
|
||||
public string Error{ get; set; }
|
||||
[Parameter]
|
||||
public int ID { 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()
|
||||
{
|
||||
@@ -134,15 +126,13 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Error = "خطای سیستمی رخ داده";
|
||||
}
|
||||
|
||||
|
||||
// nav.NavigateTo($"Verification/{res}");
|
||||
}
|
||||
else
|
||||
{
|
||||
nav.NavigateTo($"/");
|
||||
Error = await request.Content.ReadFromJsonAsync<string>();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -6,10 +6,11 @@ using System.Globalization;
|
||||
var builder = WebAssemblyHostBuilder.CreateDefault(args);
|
||||
builder.RootComponents.Add<App>("#app");
|
||||
builder.RootComponents.Add<HeadOutlet>("head::after");
|
||||
builder.Services.AddBlazorBootstrap();
|
||||
|
||||
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");
|
||||
|
||||
|
Reference in New Issue
Block a user