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(); }
/// <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); }
//修改用户信息 public bool Updateentity(T entry) { db.Entry <T>(entry).State = System.Data.EntityState.Modified; return(true); }