public ActionResult Create([Bind(Include = "loan_id,lender_id,downpayment,loan_period,emi,user_address,id_proof_file,income_certificate_file,income_tax_return_file,address_proof_file,gnn,gnn_address,gnn_address_file")] LoanRequest loanRequest)
        {
            if (ModelState.IsValid)
            {
                var loanRequest1 = new LoanRequest()
                {
                    u_id               = Convert.ToInt32(Session["u_id"]),
                    c_id               = Convert.ToInt32(Session["c_id"]),
                    d_id               = Convert.ToInt32(Session["d_id"]),
                    lender_id          = loanRequest.lender_id,
                    downpayment        = loanRequest.downpayment,
                    loan_period        = loanRequest.loan_period,
                    emi                = loanRequest.emi,
                    user_address       = loanRequest.user_address,
                    gnn                = loanRequest.gnn,
                    gnn_address        = loanRequest.gnn_address,
                    id_proof           = SaveToPhysicalLocation(loanRequest.id_proof_file),
                    income_certificate = SaveToPhysicalLocation(loanRequest.income_certificate_file),
                    income_tax_return  = SaveToPhysicalLocation(loanRequest.income_tax_return_file),
                    address_proof      = SaveToPhysicalLocation(loanRequest.address_proof_file),
                    gnn_address_p      = SaveToPhysicalLocation(loanRequest.gnn_address_file),
                };
                db.LoanRequest.Add(loanRequest1);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.c_id      = new SelectList(db.Car, "c_id", "car_manufacturer", loanRequest.c_id);
            ViewBag.d_id      = new SelectList(db.Dealer, "d_id", "company_name", loanRequest.d_id);
            ViewBag.lender_id = new SelectList(db.Lender, "lender_id", "bankname", loanRequest.lender_id);
            ViewBag.u_id      = new SelectList(db.User, "u_id", "firstname", loanRequest.u_id);
            return(View(loanRequest));
        }
        public ActionResult Create([Bind(Include = "lender_id,bankname,branchname,ifsc,b_email,contact_no,password")] Lender lender)
        {
            if (ModelState.IsValid)
            {
                db.Lender.Add(lender);
                db.SaveChanges();
                return(RedirectToAction("Index", "Home"));
            }

            return(View(lender));
        }
예제 #3
0
        public ActionResult Create([Bind(Include = "d_id,company_name,d_address,email,contact_no,password")] Dealer dealer)
        {
            if (ModelState.IsValid)
            {
                db.Dealer.Add(dealer);
                db.SaveChanges();
                return(RedirectToAction("Login"));
            }

            return(View(dealer));
        }
예제 #4
0
        public ActionResult Create([Bind(Include = "u_id,firstname,lastname,email,mobile_no,password")] User user)
        {
            if (ModelState.IsValid)
            {
                db.User.Add(user);
                db.SaveChanges();
                return(RedirectToAction("Login"));
            }

            return(View(user));
        }
        public ActionResult Create([Bind(Include = "fp_id,downpayment,user_address,mode")] FullPayment fullPayment)
        {
            if (ModelState.IsValid)
            {
                var payment = new FullPayment()
                {
                    u_id         = Convert.ToInt32(Session["u_id"]),
                    c_id         = Convert.ToInt32(Session["c_id"]),
                    d_id         = Convert.ToInt32(Session["d_id"]),
                    downpayment  = Convert.ToInt32(fullPayment.downpayment),
                    user_address = fullPayment.user_address,
                    mode         = fullPayment.mode,
                };

                db.FullPayment.Add(payment);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.c_id = new SelectList(db.Car, "c_id", "car_manufacturer", fullPayment.c_id);
            ViewBag.d_id = new SelectList(db.Dealer, "d_id", "company_name", fullPayment.d_id);
            ViewBag.u_id = new SelectList(db.User, "u_id", "firstname", fullPayment.u_id);
            return(View(fullPayment));
        }
        public ActionResult Create([Bind(Include = "c_id,car_manufacturer,car_model,car_type,price,power,fuel_tank,airbag,gear,mileage,ImageFile")] Car car)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    var car1 = new Car()
                    {
                        d_id             = Convert.ToInt32(Session["d_id"]),
                        car_manufacturer = car.car_manufacturer,
                        car_model        = car.car_model,
                        car_type         = car.car_type,
                        price            = car.price,
                        power            = car.power,
                        fuel_tank        = car.fuel_tank,
                        airbag           = car.airbag,
                        gear             = car.gear,
                        mileage          = car.mileage,
                        img = SaveToPhysicalLocation(car.ImageFile),
                    };
                    db.Car.Add(car1);

                    db.SaveChanges();
                }
                catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)
                {
                    Exception raise = dbEx;
                    foreach (var validationErrors in dbEx.EntityValidationErrors)
                    {
                        foreach (var validationError in validationErrors.ValidationErrors)
                        {
                            string message = string.Format("{0}:{1}",
                                                           validationErrors.Entry.Entity.ToString(),
                                                           validationError.ErrorMessage);
                            // raise a new exception nesting
                            // the current instance as InnerException
                            raise = new InvalidOperationException(message, raise);
                        }
                    }
                    throw raise;
                }
                return(RedirectToAction("Index"));
            }
            List <SelectListItem> manufacturer = new List <SelectListItem>()
            {
                new SelectListItem {
                    Text = "Car Manufacturer"
                },
                new SelectListItem {
                    Text = "Tata Motors", Value = "Tata Motors"
                },
                new SelectListItem {
                    Text = "Maruti Suzuki", Value = "Maruti Suzuki"
                },
                new SelectListItem {
                    Text = "Mahindra", Value = "Mahindra"
                },
                new SelectListItem {
                    Text = "Ford", Value = "Ford"
                },
                new SelectListItem {
                    Text = "Nissan", Value = "Nissan"
                },
                new SelectListItem {
                    Text = "Renault", Value = "Renault"
                },
                new SelectListItem {
                    Text = "Honda", Value = "Honda"
                },
                new SelectListItem {
                    Text = "Volkswagen", Value = "Volkswagen"
                },
                new SelectListItem {
                    Text = "Toyota", Value = "Toyota"
                },
                new SelectListItem {
                    Text = "Hyundai", Value = "Hyundai"
                },
                new SelectListItem {
                    Text = "Mercedes", Value = "Mercedes"
                },
                new SelectListItem {
                    Text = "BMW", Value = "BMV"
                },
                new SelectListItem {
                    Text = "Audi", Value = "Audi"
                },
                new SelectListItem {
                    Text = "Porsche", Value = "Porsche"
                },
                new SelectListItem {
                    Text = "Chevrolet", Value = "Chevrolet"
                },
                new SelectListItem {
                    Text = "Jeep", Value = "Jeep"
                },
                new SelectListItem {
                    Text = "MG", Value = "MG"
                },
                new SelectListItem {
                    Text = "Kia", Value = "Kia"
                },
            };

            ViewBag.car_manufacturer = manufacturer;
            List <SelectListItem> Airbag = new List <SelectListItem>()
            {
                new SelectListItem {
                    Text = "Airbag"
                },
                new SelectListItem {
                    Text = "1", Value = "1"
                },
                new SelectListItem {
                    Text = "2", Value = "2"
                },
                new SelectListItem {
                    Text = "3", Value = "3"
                },
                new SelectListItem {
                    Text = "4", Value = "4"
                },
                new SelectListItem {
                    Text = "5", Value = "5"
                },
                new SelectListItem {
                    Text = "6", Value = "6"
                },
            };

            ViewBag.airbag = Airbag;
            ViewBag.d_id   = new SelectList(db.Dealer, "d_id", "company_name", car.d_id);
            return(View(car));
        }