コード例 #1
0
        public void CreateNewProperty(Property property)
        {
            using (var context = new PropertyDb())
            {
                context.Property.Add(property);

                context.SaveChanges();
            }
        }
コード例 #2
0
        public void UpdateProperty(int id, Property property)
        {
            using (var context = new PropertyDb())
            {
                Property updateProperty = context.Property.SingleOrDefault(p => p.PropertyId == id);

                if (updateProperty != null)
                {
                    updateProperty.Address = property.Address;
                    updateProperty.Latitude = property.Latitude;
                    updateProperty.Longitude = property.Longitude;
                    updateProperty.Name = property.Name;

                    context.SaveChanges();
                }
            }
        }