public async Task <List <Contact> > GetContacts() { using (var context = contactDBContext) { var result = await context.ContactInformation.ToListAsync(); return(TypeMapperConverter.ConvertObjectCollection <ContactInformation, Contact>(result)); } }
public async Task <List <int> > AddContact(List <Contact> inputEt) { var entity = TypeMapperConverter.ConvertObjectCollection <Contact, ContactInformation>(inputEt); using (var context = contactDBContext) { contactDBContext.BulkInsert(entity, options => { options.PreserveInsertOrder = false; options.SetOutputIdentity = true; options.BulkCopyTimeout = 100; }); } return(entity.Select(x => x.ContactId).ToList()); }