@@ -289,6 +289,8 @@ public IActionResult ManageCentreManager(EditCentreManagerDetailsViewModel editC
289289 return RedirectToAction ( "ManageCentre" , "Centres" , new { centreId = editCentreManagerDetailsViewModel . CentreId } ) ;
290290 }
291291
292+ [ HttpGet ]
293+ [ NoCaching ]
292294 [ Route ( "SuperAdmin/Centres/{centreId=0:int}/CentreRoleLimits" ) ]
293295 public IActionResult CentreRoleLimits ( int centreId = 0 )
294296 {
@@ -303,7 +305,6 @@ public IActionResult CentreRoleLimits(int centreId = 0)
303305
304306 if ( ! ( roleLimits . RoleLimitCmsAdministrators != null && roleLimits . RoleLimitCmsAdministrators != - 1 ) )
305307 {
306- centreRoleLimitsViewModel . RoleLimitCmsAdministrators = null ;
307308 centreRoleLimitsViewModel . IsRoleLimitSetCmsAdministrators = false ;
308309 }
309310 else
@@ -314,7 +315,6 @@ public IActionResult CentreRoleLimits(int centreId = 0)
314315
315316 if ( ! ( roleLimits . RoleLimitCmsManagers != null && roleLimits . RoleLimitCmsManagers != - 1 ) )
316317 {
317- centreRoleLimitsViewModel . RoleLimitCmsManagers = null ;
318318 centreRoleLimitsViewModel . IsRoleLimitSetCmsManagers = false ;
319319 }
320320 else
@@ -325,7 +325,6 @@ public IActionResult CentreRoleLimits(int centreId = 0)
325325
326326 if ( ! ( roleLimits . RoleLimitCcLicences != null && roleLimits . RoleLimitCcLicences != - 1 ) )
327327 {
328- centreRoleLimitsViewModel . RoleLimitContentCreatorLicences = null ;
329328 centreRoleLimitsViewModel . IsRoleLimitSetContentCreatorLicences = false ;
330329 }
331330 else
@@ -336,7 +335,6 @@ public IActionResult CentreRoleLimits(int centreId = 0)
336335
337336 if ( ! ( roleLimits . RoleLimitCustomCourses != null && roleLimits . RoleLimitCustomCourses != - 1 ) )
338337 {
339- centreRoleLimitsViewModel . RoleLimitCustomCourses = null ;
340338 centreRoleLimitsViewModel . IsRoleLimitSetCustomCourses = false ;
341339 }
342340 else
@@ -347,7 +345,6 @@ public IActionResult CentreRoleLimits(int centreId = 0)
347345
348346 if ( ! ( roleLimits . RoleLimitTrainers != null && roleLimits . RoleLimitTrainers != - 1 ) )
349347 {
350- centreRoleLimitsViewModel . RoleLimitTrainers = null ;
351348 centreRoleLimitsViewModel . IsRoleLimitSetTrainers = false ;
352349 }
353350 else
@@ -363,6 +360,11 @@ public IActionResult CentreRoleLimits(int centreId = 0)
363360 [ Route ( "SuperAdmin/Centres/{centreId=0:int}/CentreRoleLimits" ) ]
364361 public IActionResult EditCentreRoleLimits ( CentreRoleLimitsViewModel model )
365362 {
363+ if ( ! ModelState . IsValid )
364+ {
365+ return View ( "CentreRoleLimits" , model ) ;
366+ }
367+
366368 if ( ! ( model . IsRoleLimitSetCmsAdministrators ) )
367369 {
368370 model . RoleLimitCmsAdministrators = - 1 ;
@@ -385,11 +387,6 @@ public IActionResult EditCentreRoleLimits(CentreRoleLimitsViewModel model)
385387 model . RoleLimitTrainers = - 1 ;
386388 }
387389
388- if ( ! ModelState . IsValid )
389- {
390- return View ( "CentreRoleLimits" , model ) ;
391- }
392-
393390 centresDataService . UpdateCentreRoleLimits (
394391 model . CentreId ,
395392 model . RoleLimitCmsAdministrators ,
0 commit comments