public int Upsert(Entity.Dept dept) { if (dept.Id == Guid.Empty) { dept.Id = Guid.NewGuid(); return(_deptRepository.Add(dept)); } return(_deptRepository.Update(dept)); }
public int Update(Entity.Dept dept) { _testEntities.Entry(dept).State = EntityState.Modified; return(_testEntities.SaveChanges()); }
public int Add(Entity.Dept dept) { _testEntities.Depts.Add(dept); return(_testEntities.SaveChanges()); }