public static StarSystem UpdateStarSystem(StarSystem system) { if (null == system) { throw new ArgumentNullException("expedition"); } using (var db = new EelContext()) { system.UpdatedAt = DateTime.Now; db.StarSystems.Attach(system); db.Entry(system).State = Microsoft.Data.Entity.EntityState.Modified; db.SaveChanges(); } return(system); }
public static Settings UpdateSettings(Settings settings) { if (null == settings) { throw new ArgumentNullException("expedition"); } using (var db = new EelContext()) { if (db.Settings.Count() > 0) { db.Settings.Attach(settings); db.Entry(settings).State = Microsoft.Data.Entity.EntityState.Modified; } else { db.Settings.Add(settings); } db.SaveChanges(); } return(settings); }