...
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);
|
||||
|
Reference in New Issue
Block a user