Example #1
0
 //改
 public int Edit(T s)
 {
     dbContext.Set <T>().Attach(s);
     dbContext.Entry(s).State = EntityState.Modified;
     return(dbContext.SaveChanges());
 }
Example #2
0
 /// <summary>
 /// 删除
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public bool DeleteEntity(T entity)
 {
     Db.Entry <T>(entity).State = (EntityState)System.Data.EntityState.Deleted;
     return(true);
     //return Db.SaveChanges() > 0;
 }
 //U
 public bool Update(T entity)
 {
     dbContext.Entry(entity).State = EntityState.Modified;
     return(dbContext.SaveChanges() > 0);
 }
Example #4
0
 public bool DeleteEntity(T entity)
 {
     db.Entry <T>(entity).State = System.Data.EntityState.Deleted;
     return(true);
 }
Example #5
0
 /// <summary>
 /// Updates an item
 /// </summary>
 /// <param name="entity">Item to update</param>
 public void Update(TEntity entity)
 {
     Context.Entry(entity).State = EntityState.Modified;
 }
 public void Update(TEntity item)
 {
     _context.Entry(item).State = EntityState.Modified;
 }
Example #7
0
 public void Update(T entity)
 {
     this.dbSet.Attach(entity);
     context.Entry(entity).State = EntityState.Modified;
 }