private async Task UpdateEntity(string accessToken, string refreshToken, PersonAuthEntity dalPerson, CancellationToken cancellationToken) { dalPerson.AccessKey = accessToken; dalPerson.RefreshKey = refreshToken; dalPerson.ExpirationTime = DateTime.UtcNow.AddDays(7); dalPerson.TemporaryCode = string.Empty; await _authorizationRepository.UpdatePerson(dalPerson, cancellationToken); }
public async Task UpdatePerson(PersonAuthEntity personAuthEntity, CancellationToken cancellationToken = default) { using (var context = _dbContextFactory.CreateDbContext()) { context.Update(personAuthEntity); await context.SaveChangesAsync(cancellationToken); } }
public async Task AddPerson(PersonAuthEntity personAuthEntity, CancellationToken cancellationToken) { using (var context = _dbContextFactory.CreateDbContext()) { await context.AddAsync(personAuthEntity, cancellationToken); await context.SaveChangesAsync(cancellationToken); } }
private AuthorizationPersonModel ConvertPersonModel(PersonAuthEntity dalPerson) { if (dalPerson == null) { return(null); } return(new AuthorizationPersonModel { PhoneNumber = dalPerson.PhoneNumber, PersonUid = dalPerson.PersonUid, Code = dalPerson.TemporaryCode, RefreshToken = dalPerson.RefreshKey }); }