예제 #1
0
        //
        // GET: /OptIn/ -- restaurant guide optIn
        public Object OptIn(OptInViewModel viewModel)
        {
            _vm.FirstName    = string.Empty;
            _vm.LastName     = string.Empty;
            _vm.EmailAddress = string.Empty;

            switch (this.Request.UrlReferrer.Segments[2])
            {
            case "Celiac":
                _vm.oiSource   = "CeliacCC Opt-In";
                _vm.oiDocument = "CeliacCrashCourse.pdf";
                break;

            case "PCOS":
                _vm.oiSource   = "PCOS Opt-In";
                _vm.oiDocument = "PCOSresources.pdf";
                break;

            case "Sports":
                _vm.oiSource   = "Sports Opt-In";
                _vm.oiDocument = "EnduranceAthleteNutritionGuide.pdf";
                break;

            case "Vegetarian":
                _vm.oiSource   = "Vegetarian Opt-In";
                _vm.oiDocument = "B12-Consumer.pdf";
                break;

            case "Weight":
                _vm.oiSource   = "Weight Management Opt-In";
                _vm.oiDocument = "GeneSnp.pdf";
                break;
            }

            try
            {
                if (ModelState.IsValid && string.IsNullOrEmpty(viewModel.botCheck))
                {
                    viewModel.Save(_vm);
                    return(RedirectToAction("ResetOptIn"));
                }
            }
            catch (Exception ex)
            {
#if DEBUG
                ViewData["Exception"] = "Exception: " + ex.Message + " Stack Trace: " + ex.StackTrace;
#endif
            }
            return(PartialView("_OptInPartial", _vm));
        }
        //
        // GET: /OptIn/ -- restaurant guide optIn
        public ActionResult OptIn(OptInViewModel viewModel)
        {
            try
            {
                if (ModelState.IsValid && string.IsNullOrEmpty(viewModel.botCheck))
                {
                    viewModel.Save(_vm);
                    return(RedirectToAction("ResetOptIn"));
                }
            }
            catch (Exception ex)
            {
 #if DEBUG
                ViewData["Exception"] = "Exception: " + ex.Message + " Stack Trace: " + ex.StackTrace;
#endif
            }
            return(PartialView("_OptInPartial", _vm));
        }
        // GET: /OptIn/ -- restaurant guide optIn
        public ActionResult OptIn(OptInViewModel viewModel)
        {
            viewModel.oiMessage  = PromoDisplayVM.oiMessage;
            viewModel.oiDocument = PromoDisplayVM.oiDocument;
            viewModel.oiSource   = PromoDisplayVM.Code + " Opt-In";
            try
            {
                if (ModelState.IsValid && string.IsNullOrEmpty(viewModel.botCheck))
                {
                    viewModel.Save(viewModel);

                    return(RedirectToAction("ResetOptIn", viewModel));
                }
            }
            catch (Exception ex)
            {
 #if DEBUG
                ViewData["Exception"] = "Exception: " + ex.Message + " Stack Trace: " + ex.StackTrace;
#endif
            }
            return(PartialView("_OptInPartial", viewModel));
        }