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(); }
/// <summary> /// Deprecated Method for adding a new object to the Families EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToFamilies(Family family) { base.AddObject("Families", family); }
/// <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; }