Example #1
0
        public ActionResult GetQuote(Quote userquote)
        {
            // check if all fields are filled in
            var validForm = Quote.CheckUserInputs(userquote);

            if (!validForm)
            {
                var model = new QuoteAndCarMakeVm();
                model.Carmakes    = GetCarMakes.GetCarMakeList();
                model.UserQuote   = userquote;
                ViewBag.ShowError = "d-block";
                return(View(model));
            }
            else
            {
                // if valid fields, do quote calculations
                // and return quote value
                Insurance quote       = new Insurance();
                var       quoteresult = quote.SubmitQuote(userquote);
                var       model       = new QuoteResultVm();
                model.SetQuoteResultMv(quoteresult);
                return(View("QuoteResult", model));
            }
        }