public void InsertOrUpdate(ChapterContactInfoRel chaptercontactinforel)
 {
     if (chaptercontactinforel.Id == default(int))
     {
         // New entity
         context.ContactInfo.Add(chaptercontactinforel.ContactInfo);
         context.ChapterContactInfoRels.Add(chaptercontactinforel);
     }
     else
     {
         // Existing entity
         context.Entry(chaptercontactinforel).State             = EntityState.Modified;
         context.Entry(chaptercontactinforel.ContactInfo).State = EntityState.Modified;
     }
 }
Пример #2
0
 public void InsertOrUpdateContactInfo(ChapterContactInfoRel contactInfo)
 {
     if (contactInfo.Id == default(int))
     {
         // New entity
         _ctx.ContactInfo.Add(contactInfo.ContactInfo);
         _ctx.ChapterContactInfoRels.Add(contactInfo);
     }
     else
     {
         // Existing entity
         _ctx.Entry(contactInfo).State             = EntityState.Modified;
         _ctx.Entry(contactInfo.ContactInfo).State = EntityState.Modified;
     }
 }