public static void edit(uint id, Users changes) { var orig = get(id); using (var dbContext = new WashingtonRedskinsContext()) { dbContext.Entry(orig).CurrentValues.SetValues(changes); dbContext.Entry(orig).State = EntityState.Modified; dbContext.SaveChanges(); } }
public static void edit(Registrations newRegistration, uint origId) { var orig = get(origId); using (var dbContext = new WashingtonRedskinsContext()) { dbContext.Entry(orig).CurrentValues.SetValues(newRegistration); dbContext.Entry(orig).State = EntityState.Modified; dbContext.SaveChanges(); } var earliestTime = newRegistration.Time < orig.Time ? newRegistration.Time : orig.Time; RegistrationsEdits.set(earliestTime); }
public static void delete(uint id) { var orig = get(id); using (var dbContext = new WashingtonRedskinsContext()) { orig.DeletedAt = DateTime.Now; dbContext.Entry(orig).State = EntityState.Modified; dbContext.SaveChanges(); } }