예제 #1
0
 public void UpdateSocialAccount(SocialAccountDTO item)
 {
     p1p.Data.SocialAccount mdlAccount = (p1p.Data.SocialAccount)P1PObjectMapper.Convert(item, typeof(p1p.Data.SocialAccount));
     p1p.Data.SocialAccount match;
     using (P1PContext ctx = new P1PContext())
     {
         match = ctx.SocialAccounts.Single(s => s.Id == mdlAccount.Id);
         mdlAccount.InsertDate = match.InsertDate;
         ctx.Entry(match).CurrentValues.SetValues(mdlAccount);
         ctx.SaveChanges();
     }
 }
예제 #2
0
 public void AddPersonaSocialAccount(SocialAccountDetailDTO item)
 {
     p1p.Data.SocialAccount newSocialAccount;
     p1p.Data.SocialAccount mdlSocialAccount = (p1p.Data.SocialAccount)P1PObjectMapper.Convert(item, typeof(p1p.Data.SocialAccount));
     mdlSocialAccount.InsertDate = DateTime.Now;
     using (P1PContext ctx = new P1PContext())
     {
         newSocialAccount = ctx.SocialAccounts.Add(mdlSocialAccount);
         ctx.PersonaSocialAccountXREFs.Add(new PersonaSocialAccountXREF()
         {
             PersonaId       = item.PersonaId,
             SocialAccountId = newSocialAccount.Id,
             InsertDate      = DateTime.Now
         });
         ctx.SaveChanges();
     }
 }