public decimal AddDept(T_DEPT dept) { using (var ctx = new OAContext()) { ctx.T_DEPT.Add(dept); return ctx.SaveChanges(); } }
public decimal AddDept(T_DEPT dept) { var re = _ctrl.AddDept(dept); return re; }
public decimal UpdateDept(T_DEPT dept) { var re = _ctrl.UpdateDept(dept); return re; }
public decimal UpdateDept(T_DEPT dept) { using (var ctx = new OAContext()) { ctx.T_DEPT.Attach(dept); ctx.Entry<T_DEPT>(dept).State = EntityState.Modified; return ctx.SaveChanges(); } }