@@ -365,22 +365,24 @@ public IActionResult SetCourseOptions(EditCourseOptionsFormData model)
365365 data ! . CourseOptionsData = model . ToCourseOptionsTempData ( ) ;
366366 multiPageFormService . SetMultiPageFormData ( data , MultiPageFormDataFeature . AddNewCourse , TempData ) ;
367367
368- return RedirectToAction ( "SetCourseContent" ) ;
368+ return RedirectToAction ( "SetCourseContent" , false ) ;
369369 }
370370
371371 [ HttpGet ( "AddCourse/SetCourseContent" ) ]
372372 [ TypeFilter (
373373 typeof ( RedirectMissingMultiPageFormData ) ,
374374 Arguments = new object [ ] { nameof ( MultiPageFormDataFeature . AddNewCourse ) }
375375 ) ]
376- public IActionResult SetCourseContent ( )
376+ public IActionResult SetCourseContent ( bool editCourseContent )
377377 {
378378 var data = multiPageFormService . GetMultiPageFormData < AddNewCentreCourseTempData > ( MultiPageFormDataFeature . AddNewCourse , TempData ) . GetAwaiter ( ) . GetResult ( ) ;
379379
380380 if ( ! sectionService . GetSectionsThatHaveTutorialsForApplication ( data ! . Application ! . ApplicationId ) . Any ( ) )
381381 {
382382 return RedirectToAction ( "Summary" ) ;
383383 }
384+ data . EditCourseContent = editCourseContent ;
385+ multiPageFormService . SetMultiPageFormData ( data , MultiPageFormDataFeature . AddNewCourse , TempData ) ;
384386
385387 var model = data ! . CourseContentData != null
386388 ? new SetCourseContentViewModel ( data . CourseContentData )
@@ -457,7 +459,7 @@ public IActionResult SetSectionContent(int sectionIndex)
457459 }
458460
459461 var showDiagnostic = data . Application ! . DiagAssess ;
460- if ( data . SectionContentData != null && data . SectionContentData . Count >= 3 )
462+ if ( data . EditCourseContent )
461463 {
462464 var tutorial = GetTutorialsFromSectionContentData ( data . SectionContentData , tutorials ) ;
463465 var model = new SetSectionContentViewModel ( section , sectionIndex , showDiagnostic , tutorial ) ;
@@ -649,20 +651,19 @@ private IActionResult SaveSectionAndRedirect(SetSectionContentViewModel model)
649651 {
650652 data . SectionContentData = new List < SectionContentTempData > ( ) ;
651653 }
652- if ( data . SectionContentData != null && data . SectionContentData . Count >= 3 )
654+ if ( data . EditCourseContent )
653655 {
654656 return RedirectToNextSectionOrSummary (
655657 model . Index ,
656- new SetCourseContentViewModel ( data . CourseContentData ! )
657- ) ;
658+ new SetCourseContentViewModel ( data . CourseContentData ! ) ) ;
658659 }
659- data ! . SectionContentData ! . Add (
660- new SectionContentTempData (
661- model . Tutorials != null
662- ? model . Tutorials . Select ( GetCourseTutorialData )
663- : new List < CourseTutorialTempData > ( )
664- )
665- ) ;
660+ data ! . SectionContentData ! . Add (
661+ new SectionContentTempData (
662+ model . Tutorials != null
663+ ? model . Tutorials . Select ( GetCourseTutorialData )
664+ : new List < CourseTutorialTempData > ( )
665+ )
666+ ) ;
666667 multiPageFormService . SetMultiPageFormData ( data , MultiPageFormDataFeature . AddNewCourse , TempData ) ;
667668
668669 return RedirectToNextSectionOrSummary (
0 commit comments