@@ -360,31 +360,39 @@ public IActionResult CentreRoleLimits(int centreId = 0)
360360 [ Route ( "SuperAdmin/Centres/{centreId=0:int}/CentreRoleLimits" ) ]
361361 public IActionResult EditCentreRoleLimits ( CentreRoleLimitsViewModel model )
362362 {
363- if ( ! ModelState . IsValid )
363+ if ( model . IsRoleLimitSetCmsAdministrators && model . RoleLimitCmsAdministrators == null )
364364 {
365- return View ( "CentreRoleLimits" , model ) ;
365+ ModelState [ "RoleLimitCmsAdministrators.RoleLimitCmsAdministrators" ] ? . Errors . Clear ( ) ;
366366 }
367+ model . RoleLimitCmsAdministrators ??= - 1 ;
367368
368- if ( ! ( model . IsRoleLimitSetCmsAdministrators ) )
369+ if ( model . IsRoleLimitSetCmsManagers && model . RoleLimitCmsManagers == null )
369370 {
370- model . RoleLimitCmsAdministrators = - 1 ;
371+ ModelState [ "RoleLimitCmsManagers.RoleLimitCmsManagers" ] ? . Errors . Clear ( ) ;
371372 }
373+ model . RoleLimitCmsManagers ??= - 1 ;
372374
373- if ( ! ( model . IsRoleLimitSetCmsManagers ) )
375+ if ( model . IsRoleLimitSetContentCreatorLicences && model . RoleLimitContentCreatorLicences == null )
374376 {
375- model . RoleLimitCmsManagers = - 1 ;
377+ ModelState [ "RoleLimitContentCreatorLicences.RoleLimitContentCreatorLicences" ] ? . Errors . Clear ( ) ;
376378 }
377- if ( ! ( model . IsRoleLimitSetContentCreatorLicences ) )
379+ model . RoleLimitContentCreatorLicences ??= - 1 ;
380+
381+ if ( model . IsRoleLimitSetCustomCourses && model . RoleLimitCustomCourses == null )
378382 {
379- model . RoleLimitContentCreatorLicences = - 1 ;
383+ ModelState [ "RoleLimitCustomCourses.RoleLimitCustomCourses" ] ? . Errors . Clear ( ) ;
380384 }
381- if ( ! ( model . IsRoleLimitSetCustomCourses ) )
385+ model . RoleLimitCustomCourses ??= - 1 ;
386+
387+ if ( model . IsRoleLimitSetTrainers && model . RoleLimitTrainers == null )
382388 {
383- model . RoleLimitCustomCourses = - 1 ;
389+ ModelState [ "RoleLimitTrainers.RoleLimitTrainers" ] ? . Errors . Clear ( ) ;
384390 }
385- if ( ! ( model . IsRoleLimitSetTrainers ) )
391+ model . RoleLimitTrainers ??= - 1 ;
392+
393+ if ( ! ModelState . IsValid )
386394 {
387- model . RoleLimitTrainers = - 1 ;
395+ return View ( "CentreRoleLimits" , model ) ;
388396 }
389397
390398 centresDataService . UpdateCentreRoleLimits (
0 commit comments