Beispiel #1
0
        public ActionResult Oops(OopsViewModel viewModel)
        {
            var commonSettings = _commonSettingsRepository.Table.Where(s => s.CommonCulture == cultureUsed).FirstOrDefault();
            if (commonSettings == null)
            {
                _commonSettingsRepository.Create(new CommonSettingsRecord() { DoNotAcceptAnyNewCampaigns = false, CommonCulture = cultureUsed });
                commonSettings = _commonSettingsRepository.Table.Where(s => s.CommonCulture == cultureUsed).First();
            }
            if (!commonSettings.DoNotAcceptAnyNewCampaigns)
            {
                return RedirectToAction("Oops");
            }

            if (!ModelState.IsValidField("Email"))
            {
                TempData[InvalidEmailKey] = true;
                return RedirectToAction("Oops");
            }

            var request = new CheckoutCampaignRequest {RequestUtcDate = DateTime.UtcNow, Email = viewModel.Email};
            _checkoutCampaignRequestRepository.Create(request);

            TempData[SendEmailRequestAcceptedKey] = true;
            return RedirectToAction("Oops");
        }
Beispiel #2
0
        public ActionResult Oops()
        {
            var viewModel = new OopsViewModel();

            if (TempData[InvalidEmailKey] != null)
            {
                viewModel.InvalidEmail = (bool) TempData[InvalidEmailKey];
            }

            if (TempData[SendEmailRequestAcceptedKey] != null)
            {
                viewModel.RequestAccepted = (bool) TempData[SendEmailRequestAcceptedKey];
            }
            
            return View(viewModel);
        }