public void Save() { using(var Context = new UserContext()) { var DBRecord = Context.Machines .SingleOrDefault(x => x.Id == SelectedItem.Id); if (DBRecord != null) { //Context.Machines.Attach(SelectedItem); //Context.Entry(SelectedItem).State = EntityState.Modified; //Context.SaveChanges(); } } }
public void Save() { using(var Context = new UserContext()) { var DBRecord = Context.Persons .SingleOrDefault(x => x.Id == SelectedItem.Id); if(DBRecord != null) { DBRecord.Copy(SelectedItem); Context.SaveChanges(); } } }