public static Address ToEntity(this AddressModel model) { if (model == null) return null; var entity = new Address(); return ToEntity(model, entity); }
public static Address ToEntity(this AddressModel model, Address destination) { if (model == null) return destination; destination.RowId = model.RowId; destination.CountryId = model.CountryId; destination.StateProvinceId = model.StateProvinceId; destination.City = model.City; destination.Address1 = model.Address1; destination.Address2 = model.Address2; destination.ZipPostalCode = model.ZipPostalCode; destination.PhoneNumber = model.PhoneNumber; destination.FaxNumber = model.FaxNumber; var countryService = EngineContext.Current.Resolve<ICountryService>(); var stateService = EngineContext.Current.Resolve<IStateProvinceService>(); destination.Country = countryService.GetById(destination.CountryId.Value); destination.StateProvince = stateService.GetById(destination.StateProvinceId.Value); return destination; }
public object Clone() { var addr = new Address() { Country = this.Country, CountryId = this.CountryId, StateProvince = this.StateProvince, StateProvinceId = this.StateProvinceId, City = this.City, Address1 = this.Address1, Address2 = this.Address2, ZipPostalCode = this.ZipPostalCode, PhoneNumber = this.PhoneNumber, FaxNumber = this.FaxNumber, CreatedOn = this.CreatedOn, UpdatedOn = this.UpdatedOn }; return addr; }