...
This commit is contained in:
@@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="Common\DTOs\" />
|
<Folder Include="Common\DTOs\" />
|
||||||
<Folder Include="Features\" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -34,7 +33,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Service">
|
<Reference Include="Service">
|
||||||
<HintPath>..\..\Dlls\Service.dll</HintPath>
|
<HintPath>..\..\..\LocalGit\TaxPayerTools\Service\bin\Debug\Service.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
@@ -12,11 +12,11 @@ namespace Back.Controllers
|
|||||||
[ApiController]
|
[ApiController]
|
||||||
public class VerificationController : ControllerBase
|
public class VerificationController : ControllerBase
|
||||||
{
|
{
|
||||||
//private readonly ServValidatinMsg _servValidatinMsg;
|
private readonly ServValidatinMsg _servValidatinMsg;
|
||||||
private readonly GetVerificationValidation _getVerificationValidation;
|
private readonly GetVerificationValidation _getVerificationValidation;
|
||||||
public VerificationController(/*ServValidatinMsg servValidatinMsg, */GetVerificationValidation getVerificationValidation)
|
public VerificationController(ServValidatinMsg servValidatinMsg, GetVerificationValidation getVerificationValidation)
|
||||||
{
|
{
|
||||||
//_servValidatinMsg = servValidatinMsg;
|
_servValidatinMsg = servValidatinMsg;
|
||||||
_getVerificationValidation = getVerificationValidation;
|
_getVerificationValidation = getVerificationValidation;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -40,7 +40,27 @@ namespace Back.Controllers
|
|||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
public async Task<ActionResult<bool>> Submit(VerificationCodeDto item)
|
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<servTicket > ();
|
||||||
builder.Services.AddScoped < ServValidatinMsg>();
|
builder.Services.AddScoped < ServValidatinMsg>();
|
||||||
builder.Services.AddScoped<GetVerificationValidation> ();
|
builder.Services.AddScoped<GetVerificationValidation> ();
|
||||||
|
builder.Services.AddScoped<GetVerificationValidation>();
|
||||||
|
|
||||||
|
|
||||||
string origins = "OriginTaxPayer";
|
string origins = "OriginTaxPayer";
|
||||||
builder.Services.AddCors(options =>
|
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 Back.Data.Models;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
@@ -7,9 +8,11 @@ namespace Back.Services
|
|||||||
public class ServValidatinMsg
|
public class ServValidatinMsg
|
||||||
{
|
{
|
||||||
private readonly IAsyncRepository<VerificationCode> _verificationCodeRepo;
|
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;
|
_verificationCodeRepo = verificationCodeRepo;
|
||||||
|
_ticket = ticket;
|
||||||
}
|
}
|
||||||
public async Task<VerificationCode> GetCodeByPrm(string Prm)
|
public async Task<VerificationCode> GetCodeByPrm(string Prm)
|
||||||
{
|
{
|
||||||
@@ -20,6 +23,16 @@ namespace Back.Services
|
|||||||
{
|
{
|
||||||
return await _verificationCodeRepo.Get(w => w.ID == ID).FirstOrDefaultAsync();
|
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)
|
public async Task<int> GenerateCode(VerificationCode code)
|
||||||
{
|
{
|
||||||
code.Code = Random.Shared.Next(1000, 9000);
|
code.Code = Random.Shared.Next(1000, 9000);
|
||||||
|
@@ -42,14 +42,9 @@
|
|||||||
|
|
||||||
<div class="signin-banner-from-box">
|
<div class="signin-banner-from-box">
|
||||||
|
|
||||||
<EditForm EditContext="editContext" OnValidSubmit="SubmitVerificationCode">
|
@* <EditForm EditContext="editContext" OnValidSubmit="SubmitVerificationCode"> *@
|
||||||
|
|
||||||
|
|
||||||
<DataAnnotationsValidator />
|
<EditForm Model="VerificationCodeModel" OnSubmit="SubmitVerificationCode" FormName="VerificationCodeDto">
|
||||||
<div class="postbox__comment-input mb-35">
|
|
||||||
<ValidationMessage For="()=>VerificationCodeModel.Code" />
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@@ -66,6 +61,8 @@
|
|||||||
|
|
||||||
</EditForm>
|
</EditForm>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
||||||
|
|
||||||
<label style="color:red">
|
<label style="color:red">
|
||||||
@Error
|
@Error
|
||||||
</label>
|
</label>
|
||||||
@@ -82,20 +79,15 @@
|
|||||||
</main>
|
</main>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
private EditContext? editContext;
|
|
||||||
private ValidationMessageStore? messageStore;
|
|
||||||
public string Error{ get; set; }
|
public string Error{ get; set; }
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public int ID { get; set; }
|
public int ID { get; set; }
|
||||||
|
|
||||||
[SupplyParameterFromForm]
|
[SupplyParameterFromForm]
|
||||||
public VerificationCodeDto? VerificationCodeModel { get; set; } = new VerificationCodeDto();
|
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()
|
protected override async Task OnParametersSetAsync()
|
||||||
{
|
{
|
||||||
@@ -134,15 +126,13 @@
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Error = "خطای سیستمی رخ داده";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// nav.NavigateTo($"Verification/{res}");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
nav.NavigateTo($"/");
|
Error = await request.Content.ReadFromJsonAsync<string>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -6,10 +6,11 @@ using System.Globalization;
|
|||||||
var builder = WebAssemblyHostBuilder.CreateDefault(args);
|
var builder = WebAssemblyHostBuilder.CreateDefault(args);
|
||||||
builder.RootComponents.Add<App>("#app");
|
builder.RootComponents.Add<App>("#app");
|
||||||
builder.RootComponents.Add<HeadOutlet>("head::after");
|
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");
|
CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("fa-Ir");
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user