示例#1
0
 public void Remove(User user)
 {
     using (var _dbContext = new IdentityManagementEntities())
     {
         _dbContext.Users.Attach(user);
         _dbContext.Entry(user).State = System.Data.EntityState.Deleted;
         _dbContext.SaveChanges();
     }
 }
示例#2
0
 public void Update(User user)
 {
     //save modified entity using new Context
     using (var _dbContext = new IdentityManagementEntities())
     {
         _dbContext.Users.Attach(user);
         _dbContext.Entry(user).State = System.Data.EntityState.Modified;
         _dbContext.SaveChanges();
     }
 }
示例#3
0
 public void Add(User user)
 {
     //Add to Database
     try
     {
         using (var _dbContext = new IdentityManagementEntities())
         {
             _dbContext.Users.Add(user);
             //_dbContext.Entry(user).State = System.Data.EntityState.Added;
             _dbContext.SaveChanges();
         }
     }
     catch (Exception ex)
     {
     }
 }