Example #1
0
        public ActionResult Step3(InductionStep3ViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    var induction = db.Inductions.Where(x => x.Id == viewModel.Id).FirstOrDefault();

                    // db
                    induction.UnspentCriminalConviction = viewModel.UnspentCriminalConviction;
                    induction.CriminalConvictionDetails = viewModel.CriminalConvictionDetails;
                    induction.CRTitle                       = viewModel.CRTitle;
                    induction.CRSurname                     = viewModel.CRSurname;
                    induction.CRForename                    = viewModel.CRForename;
                    induction.CRMotherSurnameBirth          = viewModel.CRMotherSurnameBirth;
                    induction.CRMotherForenameBirth         = viewModel.CRMotherForenameBirth;
                    induction.CRMaidenFamilyName            = viewModel.CRMaidenFamilyName;
                    induction.CROtherName1                  = viewModel.CROtherName1;
                    induction.CROtherName2                  = viewModel.CROtherName2;
                    induction.CROtherName3                  = viewModel.CROtherName3;
                    induction.CRDateOfBirth                 = viewModel.CRDateOfBirth;
                    induction.CRGender                      = viewModel.CRGender;
                    induction.CRTownOfBirth                 = viewModel.CRTownOfBirth;
                    induction.CRCountryOfBirth              = viewModel.CRCountryOfBirth;
                    induction.CRPassportNumber              = viewModel.CRPassportNumber;
                    induction.CRIsUKPassport                = viewModel.CRIsUKPassport;
                    induction.CRPassportCountryOfIssue      = viewModel.CRPassportCountryOfIssue;
                    induction.CRPassportIssueDate           = viewModel.CRPassportIssueDate;
                    induction.CRPassportExpiryDate          = viewModel.CRPassportExpiryDate;
                    induction.CRNationalInsuranceNumber     = viewModel.CRNationalInsuranceNumber;
                    induction.CRDriverLicense               = viewModel.CRDriverLicense;
                    induction.CRDriverLicenseCountryOfIssue = viewModel.CRDriverLicenseCountryOfIssue;
                    //
                    induction.Step3Signature  = viewModel.Step3Signature;
                    induction.Step3DateSigned = viewModel.Step3DateSigned;
                    db.SaveChanges();

                    // log
                    Helpers.Logging.LogEntry("Induction: Step3 - InductionId: " + viewModel.Id, "", false);

                    return(RedirectToAction("step4", new { guidid = viewModel.GuidId }));
                }
                catch (Exception ex)
                {
                    // log
                    Helpers.Logging.LogEntry("Induction: Step3 - InductionId: " + viewModel.Id, ex.Message, true);
                }
            }

            IEnumerable <SelectListItem> countries = db.Countries.Where(x => x.Active == true && x.Deleted == false).OrderBy(x => x.Name).ToList().Select(x => new SelectListItem()
            {
                Text     = x.Name,
                Value    = x.Id.ToString(),
                Selected = false,
            });

            ViewBag.Countries = countries;

            return(View(viewModel));
        }
Example #2
0
        // step 3

        public ActionResult Step3(string guidid)
        {
            if (!db.Inductions.Where(x => x.GuidId == guidid).Any())
            {
                return(RedirectToAction("index"));
            }

            var induction = db.Inductions.Where(x => x.GuidId == guidid).FirstOrDefault();

            IEnumerable <SelectListItem> countries = db.Countries.Where(x => x.Active == true && x.Deleted == false).OrderBy(x => x.Name).ToList().Select(x => new SelectListItem()
            {
                Text     = x.Name,
                Value    = x.Id.ToString(),
                Selected = false,
            });

            ViewBag.Countries = countries;

            var viewModel = new InductionStep3ViewModel
            {
                Id       = induction.Id,
                GuidId   = induction.GuidId,
                FullName = induction.FullName,
                //
                UnspentCriminalConviction = induction.UnspentCriminalConviction,
                CriminalConvictionDetails = induction.CriminalConvictionDetails,
                CRTitle                       = induction.CRTitle,
                CRSurname                     = induction.CRSurname,
                CRForename                    = induction.CRForename,
                CRMotherSurnameBirth          = induction.CRMotherSurnameBirth,
                CRMotherForenameBirth         = induction.CRMotherForenameBirth,
                CRMaidenFamilyName            = induction.CRMaidenFamilyName,
                CROtherName1                  = induction.CROtherName1,
                CROtherName2                  = induction.CROtherName2,
                CROtherName3                  = induction.CROtherName3,
                CRDateOfBirth                 = induction.CRDateOfBirth,
                CRGender                      = induction.CRGender,
                CRTownOfBirth                 = induction.CRTownOfBirth,
                CRCountryOfBirth              = induction.CRCountryOfBirth,
                CRPassportNumber              = induction.CRPassportNumber,
                CRIsUKPassport                = induction.CRIsUKPassport,
                CRPassportCountryOfIssue      = induction.CRPassportCountryOfIssue,
                CRPassportIssueDate           = induction.CRPassportIssueDate,
                CRPassportExpiryDate          = induction.CRPassportExpiryDate,
                CRNationalInsuranceNumber     = induction.CRNationalInsuranceNumber,
                CRDriverLicense               = induction.CRDriverLicense,
                CRDriverLicenseCountryOfIssue = induction.CRDriverLicenseCountryOfIssue,
                //
                Step3Signature  = induction.Step2Signature,
                Step3DateSigned = induction.Step2DateSigned
            };

            if (viewModel == null)
            {
                return(HttpNotFound());
            }

            return(View(viewModel));
        }