Esempio n. 1
0
        public PartialViewResult WebsiteDetails(WebsiteDetailsInputModel inputModel)
        {
            if (job == null)
            {
                return PersonalDetails();
            }

            SetJobIdCookie(job.Guid);

            if (ModelState.IsValid)
            {
                job.Website = new Domain.Website(inputModel.Website,  inputModel.CMS != "Other" ? inputModel.CMS : inputModel.CMSOther);
                job.Urgent = Convert.ToBoolean(inputModel.Urgent);
                jobService.SaveJob(job);

                return ContentDetails();
            }

            var viewModel = new WebsiteDetailsViewModel
            {
                Website = inputModel.Website.ToLower(),
                CMS = inputModel.CMS,
                CMSOther = inputModel.CMSOther,
                Urgent = inputModel.Urgent,
                CMSOptions = GetCMSOptions(),
                UrgentOptions = GetYesNoOptions()
            };

            return PartialView("WebsiteDetails", viewModel);
        }
Esempio n. 2
0
        public PartialViewResult WebsiteDetails()
        {
            if (job == null)
            {
                return PersonalDetails();
            }

            SetJobIdCookie(job.Guid);

            var viewModel = new WebsiteDetailsViewModel();
            viewModel.CMSOptions = GetCMSOptions();
            viewModel.UrgentOptions = GetYesNoOptions();

            if (job.Website != null)
            {
                var commonCms = viewModel.CMSOptions.SingleOrDefault(item => item.Text == job.Website.CMS);
                string uncommonCms = commonCms == null ? job.Website.CMS : string.Empty;

                viewModel.CMS = commonCms != null ? commonCms.Text : "Other";
                viewModel.CMSOther = uncommonCms;
                viewModel.Website = job.Website.Url != null ? job.Website.Url.ToLower() : null;
                viewModel.Urgent = job.Urgent ? 1 : 0;
            }

            SetQuoteStepCookie(QuoteStep.WebsiteDetails);
            return PartialView("WebsiteDetails", viewModel);
        }