public async Task AddPartnerLinkingInfoAsync(IPartnerLinkingInfo model) { using (var context = _contextFactory.CreateDataContext()) { var entity = PartnerLinkingInfoEntity.Create(model); context.PartnersLinkingInfo.Add(entity); await context.SaveChangesAsync(); } }
public async Task AddOrUpdatePartnerLinkingInfoAsync(IPartnerLinkingInfo model) { using (var context = _contextFactory.CreateDataContext()) { var entity = await context.PartnersLinkingInfo.FindAsync(model.PartnerId); if (entity == null) { entity = PartnerLinkingInfoEntity.Create(model); context.PartnersLinkingInfo.Add(entity); } else { entity.PartnerCode = model.PartnerCode; entity.PartnerLinkingCode = model.PartnerLinkingCode; context.PartnersLinkingInfo.Update(entity); } await context.SaveChangesAsync(); } }