public int CreateAddress(int postalCode, string addressLine1, string addressLine2, double ownershipCost, int exteriorArea, int interiorArea, int buildYear) { var database = new EstateBrokerContext(); var address = new Database.Address(); { address.PostalCode = postalCode; address.AddressLine1 = addressLine1; address.AddressLine2 = addressLine2; address.OwnershipCost = ownershipCost; address.ExteriorArea = exteriorArea; address.InteriorArea = interiorArea; address.BuildYear = buildYear; }; database.Addresses.Add(address); database.SaveChanges(); return(address.PostalCode); }
/// <summary> /// Create a new Address object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="address1">Initial value of the address property.</param> /// <param name="city">Initial value of the city property.</param> /// <param name="postalcode">Initial value of the postalcode property.</param> /// <param name="country">Initial value of the country property.</param> public static Address CreateAddress(global::System.Int64 id, global::System.String address1, global::System.String city, global::System.String postalcode, global::System.String country) { Address address = new Address(); address.Id = id; address.address = address1; address.city = city; address.postalcode = postalcode; address.country = country; return address; }
/// <summary> /// Deprecated Method for adding a new object to the AddressSet EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToAddressSet(Address address) { base.AddObject("AddressSet", address); }