public async Task <Record> UpdateAsync(RecordToUpdateDto recordDto, CancellationToken cancellationToken) { var record = await GetByIdAsync(recordDto.Id, cancellationToken); record.DateOfModification = DateTime.Now; record.Name = recordDto.Name; record.Text = recordDto.EncryptedContent; record.IvKey = recordDto.IvKey; await _dbContext.SaveChangesAsync(cancellationToken); return(record); }
public async Task <RecordVM> Handle(UpdateRecordCommand request, CancellationToken cancellationToken) { var ivKey = _aesCryptoProviderService.GenerateIV(); var recordDto = new RecordToUpdateDto { Id = request.Id, //EncryptedContent = _aesCryptoProviderService.EncryptValue(request.Content, user.CryptoKey, ivKey), Name = request.Name, IvKey = ivKey }; var record = await _recordService.UpdateAsync(recordDto, cancellationToken); return(_mapper.Map <RecordVM>(record)); }