Esempio n. 1
0
        public ActionResult AddCustomerPolicy(CustomerpolicyViewModel jg)
        {
            cs.Add(jg);
            List <CustomerpolicyViewModel> d = cs.GetAll();

            Session["CustomAll"] = d;
            return(RedirectToAction("CustomerPolicyViewAll"));
        }
        public void AddCustomerPolicy()
        {
            CheckoutInfo checkout = (CheckoutInfo)Session["checkoutInfo"];

            Vehicle_Info    vehicleInfo    = checkout.Vehicle;
            Customer_Policy customerPolicy = checkout.CustomerPolicy;

            VehicleinfoViewModel vehicle = new VehicleinfoViewModel()
            {
                address          = vehicleInfo.address,
                brandid          = vehicleInfo.brand_id,
                eginenumber      = vehicleInfo.engine_number,
                framenumber      = vehicleInfo.frame_number,
                modelid          = vehicleInfo.model_id,
                ownername        = vehicleInfo.owner_name,
                ratebycondition  = vehicleInfo.rate_by_condition,
                vehiclecondition = vehicleInfo.vehicle_condition,
                vehiclenumber    = vehicleInfo.vehicle_number,
                version          = vehicleInfo.version
            };

            VehicleinfoDAORequest request1 = new VehicleinfoDAORequest();

            request1.Add(vehicle);

            VehicleinfoViewModel vehicle2 = request1.GetByAllNumber(vehicle.framenumber, vehicle.eginenumber, vehicle.vehiclenumber);

            CustomerpolicyViewModel cPolicy = new CustomerpolicyViewModel()
            {
                active           = customerPolicy.active,
                createdate       = customerPolicy.create_date,
                customeraddprove = customerPolicy.customer_add_prove,
                customerid       = (int)customerPolicy.customer_id,
                policyenddate    = customerPolicy.policy_end_date,
                policyid         = (int)customerPolicy.policy_id,
                policystartdate  = customerPolicy.policy_start_date,
                TotalPayment     = customerPolicy.total_payment,
                vehicleid        = vehicle2.id
            };

            CustomerpolicyDAORequest request2 = new CustomerpolicyDAORequest();

            request2.Add(cPolicy);
        }