...
This commit is contained in:
@@ -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