public void SaveDependent(Dependent dependent) { if (dependent.Id > 0) { var pModel = _db.Dependents.FirstOrDefault(p => p.Id == dependent.Id); if (pModel != null) { DependentMapping.CopyPropertiesForUpdate(dependent, ref pModel); } } else { _db.Dependents.Add(dependent); } _db.SaveChanges(); }
public void SavePerson(Person person) { if (person.Id > 0) { var pModel = _db.People.FirstOrDefault(p => p.Id == person.Id); if (pModel != null) { PersonMapping.CopyPropertiesForUpdate(person, ref pModel); } } else { _db.People.Add(person); } _db.SaveChanges(); }