public async Task <IEnumerable <IKycDocument> > GetOneEachTypeAsync(string clientId) { var partitionKey = KycDocumentEntity.GeneratePartitionKey(clientId); var docs = (await _tableStorage.GetDataAsync(partitionKey)).ToList(); var result = new List <IKycDocument>(); var latestIdCard = docs.OrderByDescending(x => x.DateTime).FirstOrDefault(x => x.Type == KycDocumentTypes.IdCard); if (latestIdCard != null) { result.Add(latestIdCard); } var latestSelfie = docs.OrderByDescending(x => x.DateTime).FirstOrDefault(x => x.Type == KycDocumentTypes.Selfie); if (latestSelfie != null) { result.Add(latestSelfie); } var latestProofOfAddress = docs.OrderByDescending(x => x.DateTime).FirstOrDefault(x => x.Type == KycDocumentTypes.ProofOfAddress); if (latestProofOfAddress != null) { result.Add(latestProofOfAddress); } return(result); }
public async Task <IKycDocument> AddAsync(IKycDocument kycDocument) { var newDocument = KycDocumentEntity.Create(kycDocument); await _tableStorage.InsertAsync(newDocument); return(newDocument); }
public async Task <IKycDocument> DeleteAsync(string clientId, string documentId) { var partitionKey = KycDocumentEntity.GeneratePartitionKey(clientId); var rowKey = KycDocumentEntity.GenerateRowKey(documentId); return(await _tableStorage.DeleteAsync(partitionKey, rowKey)); }
public async Task <IEnumerable <IKycDocument> > GetAsync(string clientId) { var partitionKey = KycDocumentEntity.GeneratePartitionKey(clientId); return(await _tableStorage.GetDataAsync(partitionKey)); }