public int Edit(SysUser entity) { using (AppDBContainer db = new AppDBContainer()) { db.SysUser.Attach(entity); db.Entry(entity).State = EntityState.Modified; return(db.SaveChanges()); } }
/// <summary> /// 修改一个实体 ///</summary> /// <param name="db">数据库上下文</param> /// <param name="entity">实体</param> public int Edit(SysSample entity) { using (AppDBContainer db = new AppDBContainer()) { db.Set <SysSample>().Attach(entity); db.Entry <SysSample>(entity).State = EntityState.Modified; return(db.SaveChanges()); } }
public int Edit(SysRole entity) { using (AppDBContainer db = new AppDBContainer()) { db.SysRole.Attach(entity); db.Entry <SysRole>(entity).State = System.Data.EntityState.Modified; return(db.SaveChanges()); } }
public int Edit(MIS_Article_Category entity) { using (AppDBContainer db = new AppDBContainer()) { db.MIS_Article_Category.Attach(entity); db.Entry(entity).State = EntityState.Modified; return(db.SaveChanges()); } }