public Model.TimeZone Add(Model.TimeZone entity) { using (var context = new TimeZoneManagerEntities()) { context.TimeZones.Add(entity); context.SaveChanges(); return(entity); } }
public void Remove(int id) { using (var context = new TimeZoneManagerEntities()) { var entity = context.TimeZones.Single(e => e.ID == id); if (entity != null) { context.TimeZones.Remove(entity); context.SaveChanges(); } } }
public void Update(Model.TimeZone entity) { using (var context = new TimeZoneManagerEntities()) { var entityToUpdate = context.TimeZones.SingleOrDefault(e => e.ID == entity.ID); if (entityToUpdate != null) { entityToUpdate.Name = entity.Name; entityToUpdate.City = entity.City; entityToUpdate.GMTOffset = entity.GMTOffset; context.SaveChanges(); } } }