Esempio n. 1
0
 public void Update(UserDetail userDetail)
 {
     using (UserEntities context = DbContextFactory.Create())
     {
         context.Entry(userDetail).State = EntityState.Modified;
         context.SaveChanges();
     }
 }
Esempio n. 2
0
 public void Insert(UserDetail userDetail)
 {
     using (UserEntities context = DbContextFactory.Create())
     {
         context.Set <UserDetail>().Add(userDetail);
         context.Entry(userDetail).State = EntityState.Added;
         context.SaveChanges();
     }
 }
Esempio n. 3
0
 public void DeleteByPK(int id)
 {
     using (UserEntities context = DbContextFactory.Create())
     {
         var userDetail = context.UserDetails.FirstOrDefault(x => x.UserId == id);
         if (userDetail == null)
         {
             return;
         }
         context.Entry(userDetail).State = EntityState.Deleted;
         context.SaveChanges();
     }
 }