Exemplo n.º 1
0
        public void Delete(int ID)
        {
            OAEntities enty = new OAEntities();

            var user = enty.Users.Where(a => a.Id == ID).FirstOrDefault();

            enty.Entry(user).State = System.Data.EntityState.Deleted;

            int row = enty.SaveChanges();

            Response.Write(row);
            Response.End();
        }
Exemplo n.º 2
0
 /// <summary>
 /// 删除
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public bool DeleteEntity(T entity)
 {
     Db.Entry <T>(entity).State = System.Data.EntityState.Deleted;
     // return Db.SaveChanges() > 0;
     return(true);
 }
Exemplo n.º 3
0
 //修改用户信息
 public bool Updateentity(T entry)
 {
     db.Entry <T>(entry).State = System.Data.EntityState.Modified;
     return(true);
 }