예제 #1
0
        public ActionResult UpdateDependent(string UpdateType, Models.Customer.CustomerDependents custDependents)
        {
            Models.Customer.CustomerDependentsModel md = new CustomerDependentsModel();
            Mapper.CreateMap <BusinessObjects.Province, Models.Customer.Province>();
            Mapper.CreateMap <BusinessObjects.City, Models.Customer.City>();
            Mapper.CreateMap <BusinessObjects.Gender, Models.Customer.Gender>();
            Mapper.CreateMap <BusinessObjects.RelationshipType, Models.Customer.RelationshipType>();
            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(custDependents.ProvinceID));
            IEnumerable <Models.Customer.Gender>           Gender           = Mapper.Map <IEnumerable <BusinessObjects.Gender>, IEnumerable <Models.Customer.Gender> >(service.getGender());
            IEnumerable <Models.Customer.RelationshipType> RelationshipType = Mapper.Map <IEnumerable <BusinessObjects.RelationshipType>, IEnumerable <Models.Customer.RelationshipType> >(service.getRelationshipType());

            md.custDependents   = custDependents;
            md.Province         = Province;
            md.City             = City;
            md.Gender           = Gender;
            md.RelationshipType = RelationshipType;
            var pvr = new PartialViewResult();

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