public static KycInformationEntity Create(IKycInformation model)
 {
     return(new KycInformationEntity
     {
         KycStatus = model.KycStatus,
         PartnerId = model.PartnerId,
         AdminUserId = model.AdminUserId,
         Comment = model.Comment,
         Timestamp = model.Timestamp,
     });
 }
Exemplo n.º 2
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();
            }
        }
Exemplo n.º 3
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();
            }
        }