Esempio n. 1
0
        public static bool Update(AEdLocation rec)
        {
            using (var db = GetContext())
              {

            // Add the new object to the AEdLocation collection.
            var current = db.AEdLocation.FirstOrDefault(a => a.ID == rec.ID);
            if (current == null)
              return false;

            current.Contact = rec.Contact;
            current.Address = rec.Address;
            current.Comments = rec.Comments;
            current.Email = rec.Email;
            current.FirstName = rec.FirstName;
            current.LastName = rec.LastName;
            current.Phone = rec.Phone;
            current.Latitude = rec.Latitude;
            current.Longitude = rec.Longitude;
            current.PublicAccess = rec.PublicAccess;

            // Submit the change to the database.
            try
            {
              db.SubmitChanges();
            }
            catch (Exception)
            {
              return false;
            }
              }
              return true;
        }
Esempio n. 2
0
        /// <summary>
        /// Inserts the specified location.
        /// </summary>
        /// <param name="location">The location.</param>
        /// <returns></returns>
        public static bool Insert(AEdLocation location)
        {
            using (var db = GetContext())
              {

            // Add the new object to the AEdLocation collection.
            db.AEdLocation.InsertOnSubmit(location);

            // Submit the change to the database.
            try
            {
              db.SubmitChanges();
            }
            catch (Exception)
            {
              return false;
            }
              }
              return true;
        }