private void LoadEntity(IBorrowerEntity entity) { SetEntityProperty(entity, e => e.Position, _PositionProperty); SetEntityProperty(entity, e => e.EdisclosureConsent, _EDisclosureConsentProperty); SetEntityProperty(entity, e => e.EmailConsent, _EmailConsentProperty); SetEntityProperty(entity, e => e.EmailAddress, _EmailAddressProperty); }
private void LoadModel(IBorrowerEntity entity) { LoadProperty(_IdProperty, entity.Id); LoadProperty(_PositionProperty, entity.Position); LoadProperty(_EDisclosureConsentProperty, entity.EdisclosureConsent); LoadProperty(_EmailConsentProperty, entity.EmailConsent); LoadProperty(_EmailAddressProperty, entity.EmailAddress); LoadProperty(_ParnterIdProperty, entity.Profile.PartnerId); LoadProperty(_CobranderIdProperty, entity.Profile.CobranderId); LoadProperty(_SiteProfileIdProperty, entity.Profile.SiteProfileId); LoadProperty(_AccountIdProperty, entity.Profile.AccountId); }
async Task IBorrowerContext.InsertAsync(IBorrowerEntity borrower, Guid partnerId, Guid cobranderId, Guid siteProfileId, Guid accountId) { var entity = borrower as BorrowerEntity; if (entity == null) { throw new InvalidCastException("IBorrowerEntity is not of type BorrowerEntity"); } var borrowerEntity = entity.Entity; Context.Borrower.Add(borrowerEntity); await Context.SaveChangesAsync(); await(this as IProfileContext).InsertAsync(partnerId, cobranderId, siteProfileId, accountId, borrower.Id); }
async Task IBorrowerContext.UpdateAsync(IBorrowerEntity borrower) { var entity = borrower as BorrowerEntity; if (entity == null) { throw new InvalidCastException("IBorrowerEntity is not of type BorrowerEntity"); } var borrowerEntity = new EntityModel.Borrower { Id = borrower.Id }; Context.Borrower.Attach(borrowerEntity); borrowerEntity.UpdateChanged(entity, Context, db => db.Position, e => e.Position); borrowerEntity.UpdateChanged(entity, Context, db => db.EdisclosureConsent, e => e.EdisclosureConsent); borrowerEntity.UpdateChanged(entity, Context, db => db.EmailConsent, e => e.EmailConsent); borrowerEntity.UpdateChanged(entity, Context, db => db.EmailAddress, e => e.EmailAddress); await Context.SaveChangesAsync(); }
private void DataPortal_Fetch(IBorrowerEntity entity) { LoadModel(entity); }