public IActionResult SaveOutsideSectors(OutsideSectorsViewModel model) { Session.SetSubmittedPage(FormSection.Organisation, 2); if (!ModelState.IsValid) { return(View(GetViewPath(FormSection.Organisation, 2), model)); } // update the non collection part LicenceApplicationPostDataHandler.Update(Session.GetCurrentLicenceId(), x => x, model); LicenceApplicationPostDataHandler.Update(Session.GetCurrentLicenceId(), x => x.SelectedSectors, model.SelectedSectors); return(CheckParentValidityAndRedirect(FormSection.Organisation, 2)); }
private OutsideSectorsViewModel SectorResolver(Licence licence) { var vm = new OutsideSectorsViewModel { OtherSector = licence.OtherSector, SuppliesWorkersOutsideLicensableAreas = licence.SuppliesWorkersOutsideLicensableAreas, YesNo = ProfileHelpers.YesNoList }; if (licence.SelectedSectors != null) { foreach (var item in licence.SelectedSectors) { vm.SelectedSectors.Single(x => x.Id == item.Id).Checked = true; } } return(vm); }