public void Put(Reader reader) { using (IPrompterDbContext context = _dbContextFactory.Create()) { context.Entry(reader).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); } }
public void Put(Preference preference) { using (IPrompterDbContext context = _dbContextFactory.Create()) { preference.Id = 0; Preference pref = this.Get(temp => preference.ReaderId == temp.ReaderId && preference.ScriptId == temp.ScriptId); if (pref == null) { this.Post(preference); } else { preference.Id = pref.Id; context.Entry(preference).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); } } }