Esempio n. 1
0
        /// <summary>
        /// 删除用户
        /// </summary>
        /// <param name="models"></param>
        public void RemoveUserTable(UserTableViewModel models)
        {
            using (var db = new AALifeDbContext())
            {
                var userTable = models.Adapt <UserTable>();
                db.Entry <UserTable>(userTable).State = System.Data.Entity.EntityState.Deleted;

                db.SaveChanges();
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 更新用户--批量
        /// </summary>
        /// <param name="models"></param>
        public void UpdateUserTable(List <UserTableViewModel> models)
        {
            using (var db = new AALifeDbContext())
            {
                models.ForEach((model) => {
                    var userTable = model.Adapt <UserTable>();
                    db.Entry <UserTable>(userTable).State = System.Data.Entity.EntityState.Modified;
                });

                db.SaveChanges();
            }
        }