/// <summary> /// Populates a Contacts Object from a View Model Object's properties. /// </summary> /// /// /// <param name="newLocation"> A View Model Object from which to extract from </param> /// /// /// <returns> Null if all fields are null, otherwise returns a Contacts object </returns> public static Contacts GetNewContact(AllTablesViewModel newLocation) { if (newLocation is null) { return(null); } Contacts contact = new Contacts(); contact.LocationId = newLocation.LocationId; contact.Phone = newLocation.Phone; contact.Fax = newLocation.Fax; contact.WebAddress = newLocation.WebAddress; if (contact.AllPropertiesAreNull()) { return(null); } return(contact); }