...
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
using Back.Common.Enums;
|
||||
using Back.Data.Models;
|
||||
using Back.Services;
|
||||
using Back.Validations;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Shared.DTOs;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
namespace Back.Controllers
|
||||
{
|
||||
@@ -12,12 +15,42 @@ namespace Back.Controllers
|
||||
[ApiController]
|
||||
public class TicketController : ControllerBase
|
||||
{
|
||||
private readonly MobileValidation _mobilevalidation;
|
||||
private readonly servTicket _servTicket;
|
||||
private readonly ServValidatinMsg _servValidatinMsg;
|
||||
public TicketController(MobileValidation mobilevalidation, servTicket servTicket, ServValidatinMsg servValidatinMsg)
|
||||
{
|
||||
_mobilevalidation = mobilevalidation;
|
||||
_servTicket = servTicket;
|
||||
_servValidatinMsg = servValidatinMsg;
|
||||
}
|
||||
|
||||
[HttpPost("NewTicketNoAuthentication")]
|
||||
[AllowAnonymous]
|
||||
public async Task<ActionResult<int>> NewTicketNoAuthentication(CTicketNoAuthenticationDto item)
|
||||
{
|
||||
return Ok();
|
||||
var resultValidationmodel = await _mobilevalidation.ValidateAsync(item.Mobile);
|
||||
if (!resultValidationmodel.IsValid)
|
||||
return BadRequest(resultValidationmodel.Errors.Select(s => s.ErrorMessage).ToList());
|
||||
|
||||
var pid=await _servTicket.NewPepole(item.FullName,item.Mobile);
|
||||
item.CompanyID = pid.Value.ToString();
|
||||
var Ticket = await _servTicket.NewTicket(item, StatusTicket.unknownPerson);
|
||||
|
||||
var code= await _servValidatinMsg.GenerateCode(new VerificationCode
|
||||
{
|
||||
ID = 0,
|
||||
prm = Ticket.ID.ToString(),
|
||||
val = item.Mobile,
|
||||
Type = "NewTicketNoAuthentication"
|
||||
});
|
||||
|
||||
return Ticket == null ? BadRequest() : Ok(new VerificationCodeDto
|
||||
{
|
||||
prm = Ticket.ID.ToString(),
|
||||
val = item.Mobile,
|
||||
Type = "NewTicketNoAuthentication"
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user