Ejemplo n.º 1
0
        public void AddLocation(LocationWrapper locationWrapper)
        {
            Location locationToAdd = locationWrapper.getLocation();

            Task.Run(() =>
            {
                context.Locations.InsertOnSubmit(locationToAdd);
                context.SubmitChanges();
            });
        }
Ejemplo n.º 2
0
 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();
     });
 }