示例#1
0
 public bool DeleteGroup(PageGroup pageGroup)
 {
     try
     {
         db.Entry(pageGroup).State = EntityState.Deleted;
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
 public bool UpdatePage(Page page)
 {
     try
     {
         db.Entry(page).State = EntityState.Modified;
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
 public bool UpdateGroup(PageGroup pageGroup)
 {
     try
     {
         db.Entry(pageGroup).State = EntityState.Modified;    // At first find in DB by state find the primarykey and after that modified the field
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
示例#4
0
 public virtual bool Update(TEntity entity)
 {
     try
     {
         _dbSet.Attach(entity);
         _db.Entry(entity).State = EntityState.Modified;
         return(true);
     }
     catch
     {
         return(false);
     }
 }
示例#5
0
 public virtual void Update(T obj)
 {
     _table.Attach(obj);
     _context.Entry(obj).State = EntityState.Modified;
 }