コード例 #1
0
        public void SaveAddressInformation(PersonViewModel person, Address address, Family family)
        {
            if (address == null)
            {
                address = new Address { Created = DateTime.Now, Changed = DateTime.Now };
                family.Address = address;
            }

            if (address.Line1 != person.Address1 ||
                address.Line2 != person.Address2 ||
                address.Line3 != person.Address3 ||
                address.Line4 != person.Address4)
                address.Changed = DateTime.Now;

            address.Line1 = person.Address1 ?? string.Empty;
            address.Line2 = person.Address2 ?? string.Empty;
            address.Line3 = person.Address3 ?? string.Empty;
            address.Line4 = person.Address4 ?? string.Empty;
            address.Lat = person.Lat;
            address.Long = person.Lng;

            Context.SaveChanges();
        }
コード例 #2
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Families EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToFamilies(Family family)
 {
     base.AddObject("Families", family);
 }
コード例 #3
0
 /// <summary>
 /// Create a new Family object.
 /// </summary>
 /// <param name="familyId">Initial value of the FamilyId property.</param>
 /// <param name="familyName">Initial value of the FamilyName property.</param>
 /// <param name="created">Initial value of the Created property.</param>
 /// <param name="changed">Initial value of the Changed property.</param>
 public static Family CreateFamily(global::System.Int32 familyId, global::System.String familyName, global::System.DateTime created, global::System.DateTime changed)
 {
     Family family = new Family();
     family.FamilyId = familyId;
     family.FamilyName = familyName;
     family.Created = created;
     family.Changed = changed;
     return family;
 }