Exemplo n.º 1
0
        public ActionResult Next2(int CarYear, string CarMake, string CarModel)
        {
            if (CarYear <= 0 || (string.IsNullOrEmpty(CarMake)) || (string.IsNullOrEmpty(CarModel)))
            {
                return(View("~/Views/Shared/Error.cshtml"));
            }
            else
            {
                using (CarInsuranceMVCEntities3 db = new CarInsuranceMVCEntities3())
                {
                    if (TempData.ContainsKey("user"))
                    {
                        var app = TempData["user"] as user;
                        app.CarYear  = CarYear;
                        app.CarMake  = CarMake;
                        app.CarModel = CarModel;

                        //db.users.Add(app);
                        db.SaveChanges();
                        TempData.Keep("user");
                    }
                }
            }

            return(RedirectToAction("Form3"));
        }
Exemplo n.º 2
0
        public ActionResult Next1(string firstName, string lastName, DateTime DateOfBirth, string EmailAddress)
        {
            if (string.IsNullOrEmpty(firstName) || (string.IsNullOrEmpty(lastName) || DateOfBirth == null))
            {
                return(View("~/Views/Shared/Error.cshtml"));
            }
            else
            {
                using (CarInsuranceMVCEntities3 db = new CarInsuranceMVCEntities3())
                {
                    if (TempData.ContainsKey("user"))
                    {
                        var app = TempData["user"] as user;
                        app.FirstName    = firstName;
                        app.LastName     = lastName;
                        app.DateOfBirth  = DateOfBirth;
                        app.EmailAddress = EmailAddress;

                        //db.users.Add(app);
                        db.SaveChanges();
                        TempData.Keep("user");
                    }
                }
            }

            return(RedirectToAction("Form2"));
        }
Exemplo n.º 3
0
        // GET: Admin
        public ActionResult Index()
        {
            var quotes = new List <user>();

            using (CarInsuranceMVCEntities3 db = new CarInsuranceMVCEntities3())
            {
                var userList = db.users.ToList();
                foreach (var x in userList)
                {
                    quotes.Add(x);
                }
            }
            return(View(quotes));
        }
Exemplo n.º 4
0
        public ActionResult Quote()
        {
            using (CarInsuranceMVCEntities3 db = new CarInsuranceMVCEntities3())
            {
                if (TempData.ContainsKey("user"))
                {
                    var app = TempData["user"] as user;


                    return(View(app));
                }
                else
                {
                    return(View("~/Views/Shared/Error.cshtml"));
                }
            }
        }
Exemplo n.º 5
0
        public ActionResult Submit(string DUI_radios, int tickets, string CoverageType)
        {
            if ((DUI_radios == null) || string.IsNullOrEmpty(CoverageType))
            {
                return(View("~/Views/Shared/Error.cshtml"));
            }
            else
            {
                using (CarInsuranceMVCEntities3 db = new CarInsuranceMVCEntities3())
                {
                    if (TempData.ContainsKey("user"))
                    {
                        var app = TempData["user"] as user;
                        switch (DUI_radios)
                        {
                        case "no":
                            app.DUI = false;
                            break;

                        case "yes":
                            app.DUI = true;
                            break;

                        default:
                            return(View("~/Views/Shared/Error.cshtml"));
                        }

                        app.Tickets      = tickets;
                        app.CoverageType = CoverageType;

                        db.users.Add(app);
                        db.SaveChanges();
                        TempData.Keep("user");
                    }
                }


                return(RedirectToAction("Quote"));
            }
        }