Exemple #1
0
        public ActionResult UpdateAddress(string UpdateType, Models.Customer.CustomerAddress custAddress)
        {
            Models.Customer.CustomerAddressModel md = new CustomerAddressModel();
            Mapper.CreateMap <BusinessObjects.Province, Models.Customer.Province>();
            Mapper.CreateMap <BusinessObjects.City, Models.Customer.City>();
            Mapper.CreateMap <BusinessObjects.HomeOwnership, Models.Customer.HomeOwnership>();
            Mapper.CreateMap <BusinessObjects.AddressType, Models.Customer.AddressType>();
            IEnumerable <Models.Customer.Province>      Province      = Mapper.Map <IEnumerable <BusinessObjects.Province>, IEnumerable <Models.Customer.Province> >(service.getProvince());
            IEnumerable <Models.Customer.City>          City          = Mapper.Map <IEnumerable <BusinessObjects.City>, IEnumerable <Models.Customer.City> >(service.updateCity(custAddress.ProvinceID));
            IEnumerable <Models.Customer.HomeOwnership> HomeOwnership = Mapper.Map <IEnumerable <BusinessObjects.HomeOwnership>, IEnumerable <Models.Customer.HomeOwnership> >(service.getHomeOwnership());
            IEnumerable <Models.Customer.AddressType>   AddressType   = Mapper.Map <IEnumerable <BusinessObjects.AddressType>, IEnumerable <Models.Customer.AddressType> >(service.getAddressType(false));

            md.custAddress   = custAddress;
            md.Province      = Province;
            md.City          = City;
            md.HomeOwnership = HomeOwnership;
            md.AddressType   = AddressType;
            var pvr = new PartialViewResult();

            if (UpdateType == "update")
            {
                pvr = PartialView("_UpdateAddress", md);
            }
            else if (UpdateType == "add")
            {
                pvr = PartialView("_AddAddress", md);
            }
            return(pvr);
        }