public void AddLocation(LocationWrapper locationWrapper) { Location locationToAdd = locationWrapper.getLocation(); Task.Run(() => { context.Locations.InsertOnSubmit(locationToAdd); context.SubmitChanges(); }); }
public void UpdateLocation(int id, LocationWrapper location) { Task.Run(() => { Location updatedLocation = context.Locations.Where(p => p.LocationID == location.LocationID).FirstOrDefault(); foreach (System.Reflection.PropertyInfo property in updatedLocation.GetType().GetProperties()) { if (property.CanWrite) { property.SetValue(updatedLocation, property.GetValue(location.getLocation())); } } context.SubmitChanges(); }); }