示例#1
0
        public int SaveContactSummary(ContactSummary ContactSummary)
        {
            using (var entities = new ContactsEntities())
            {
                ContactSummary result = entities.ContactSummaries.Add(ContactSummary);
                entities.SaveChanges();

                return(result.ContactSummaryId);
            }
        }
示例#2
0
        public void SaveContactDetail(List <ContactDetail> ContactDetail, int ContactSummaryId)
        {
            using (var entities = new ContactsEntities())
            {
                foreach (var contactDetail in ContactDetail)
                {
                    ContactDetail dbContactDetail = new Database.ContactDetail();

                    dbContactDetail.Name             = contactDetail.Name;
                    dbContactDetail.Company          = contactDetail.Company;
                    dbContactDetail.Email            = contactDetail.Email;
                    dbContactDetail.Phone            = contactDetail.Phone;
                    dbContactDetail.ContactSummaryId = ContactSummaryId;

                    entities.ContactDetails.Add(dbContactDetail);
                }

                entities.SaveChanges();
            }
        }