/// <summary> /// Create a new instance of an Address. /// </summary> /// <param name="id"></param> /// <param name="address1"></param> /// <param name="address2"></param> /// <param name="postal"></param> /// <returns></returns> public static Entity.Address CreateAddress(this PimsContext context, int id, string address1, string address2, string postal) { var province = context.Provinces.Find("BC") ?? EntityHelper.CreateProvince("BC", "British Columbia"); return(new Entity.Address(address1, address2, "Victoria", province, postal) { Id = id, RowVersion = new byte[] { 12, 13, 14 } }); }
/// <summary> /// Create a new instance of an Address. /// </summary> /// <param name="id"></param> /// <param name="address"></param> /// <param name="unitNumber"></param> /// <param name="municipality"></param> /// <param name="province"></param> /// <param name="district"></param> /// <param name="postal"></param> /// <returns></returns> public static Entity.PimsAddress CreateAddress(long id, string address, string unitNumber, string municipality, Entity.PimsProvinceState province = null, Entity.PimsDistrict district = null, string postal = "V9V9V9") { province ??= EntityHelper.CreateProvince((short)id, "BC", EntityHelper.CreateCountry((short)id, "CAN")); district ??= EntityHelper.CreateDistrict((short)id, "District 1"); municipality ??= "municipality"; return(new Entity.PimsAddress(address, unitNumber, municipality, province, district, postal) { AddressId = id, ConcurrencyControlNumber = 1 }); }
/// <summary> /// Create a new instance of an Address. /// </summary> /// <param name="id"></param> /// <param name="address1"></param> /// <param name="address2"></param> /// <param name="postal"></param> /// <returns></returns> public static Entity.Address CreateAddress(int id, string address1, string address2, string postal) { var city = EntityHelper.CreateCity("VIC", "Victoria"); var province = EntityHelper.CreateProvince("BC", "British Columbia"); return(new Entity.Address(address1, address2, city, province, postal) { Id = id, RowVersion = new byte[] { 12, 13, 14 } }); }
/// <summary> /// Create a new instance of an Address. /// </summary> /// <param name="id"></param> /// <param name="address1"></param> /// <param name="address2"></param> /// <param name="postal"></param> /// <returns></returns> public static Entity.Address CreateAddress(int id, string address1, string address2, string postal, Entity.Province province = null) { if (province == null) { province = EntityHelper.CreateProvince("BC", "British Columbia"); } return(new Entity.Address(address1, address2, "Victoria", province, postal) { Id = id, RowVersion = new byte[] { 12, 13, 14 } }); }