Exemple #1
0
        public ActionResult UpdateCity(string ProvinceID)
        {
            Mapper.CreateMap <BusinessObjects.City, Models.Customer.City>();
            IEnumerable <Models.Customer.City> City = Mapper.Map <IEnumerable <BusinessObjects.City>, IEnumerable <Models.Customer.City> >(service.updateCity(ProvinceID));

            return(Json(City, JsonRequestBehavior.AllowGet));
        }
        public ActionResult UpdateAddress(string UpdateType, Models.MaintenanceAgentProfile.AgentAddress AgentAddress)
        {
            Models.MaintenanceAgentProfile.AgentAddressModel md = new Models.MaintenanceAgentProfile.AgentAddressModel();
            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> >(customerSvc.getProvince());
            IEnumerable <Models.Customer.City>          City          = Mapper.Map <IEnumerable <BusinessObjects.City>, IEnumerable <Models.Customer.City> >(customerSvc.updateCity(AgentAddress.ProvinceID));
            IEnumerable <Models.Customer.HomeOwnership> HomeOwnership = Mapper.Map <IEnumerable <BusinessObjects.HomeOwnership>, IEnumerable <Models.Customer.HomeOwnership> >(customerSvc.getHomeOwnership());
            IEnumerable <Models.Customer.AddressType>   AddressType   = Mapper.Map <IEnumerable <BusinessObjects.AddressType>, IEnumerable <Models.Customer.AddressType> >(customerSvc.getAddressType(false));

            md.AgentAddress  = AgentAddress;
            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);
        }