コード例 #1
0
        public async Task AddIfNotExistsAsync(IKycInformation model)
        {
            using (var context = _contextFactory.CreateDataContext())
            {
                if (await context.KycInformation.FindAsync(model.PartnerId) != null)
                    return;

                var kycInformationEntity = KycInformationEntity.Create(model);
                var statusChangeEntity = KycInformationStatusChangeEntity.Create(model.PartnerId, model.AdminUserId,
                    model.Timestamp, model.Comment, null, model.KycStatus);

                context.KycInformation.Add(kycInformationEntity);
                context.KycInformationStatusChange.Add(statusChangeEntity);

                await context.SaveChangesAsync();
            }
        }
コード例 #2
0
        public async Task UpdateAsync(IKycInformation model)
        {
            using (var context = _contextFactory.CreateDataContext())
            {
                var entity = await context.KycInformation.FindAsync(model.PartnerId);
                var statusChangeEntity = KycInformationStatusChangeEntity.Create(model.PartnerId, model.AdminUserId,
                    model.Timestamp, model.Comment, entity.KycStatus, model.KycStatus);

                entity.KycStatus = model.KycStatus;
                entity.Comment = model.Comment;
                entity.Timestamp = model.Timestamp;
                entity.AdminUserId = model.AdminUserId;

                context.KycInformation.Update(entity);
                context.KycInformationStatusChange.Add(statusChangeEntity);

                await context.SaveChangesAsync();
            }
        }