private IController CreateController(ControllerType controllerType, ModuleCore module, RouteValueDictionary routeValues) { var targetType = module.ControllerTypes.GetValueOrDefault(controllerType.ControllerTypeID); if (targetType == null) { throw new NotSupportedException(controllerType.ErrorCannotFindControllerTypeSpecified(module, routeValues)); } if (!controllerType.CheckPermissions(module, routeValues)) { throw new Core.Exceptions.ErrorCodeException(HttpStatusCode.Forbidden, "Отсутствует доступ."); } if (targetType != null) { return(CreateController(module, targetType, routeValues)); } return(null); }