コード例 #1
0
        public HttpResponseMessage ListAllPages(int portalId)
        {
            var apiResponse = new DTO.ApiResponse <List <DTO.GenericListItem> > ();

            try
            {
                apiResponse.CustomObject = new List <DTO.GenericListItem>();

                foreach (var tab in DotNetNuke.Entities.Tabs.TabController.GetPortalTabs(portalId, -1, true, true, false, false))
                {
                    var newGenericItem = new DTO.GenericListItem();
                    newGenericItem.Name  = tab.IndentedTabName;
                    newGenericItem.Value = tab.TabID.ToString();
                    apiResponse.CustomObject.Add(newGenericItem);
                }

                apiResponse.Success = true;
            }
            catch (Exception err)
            {
                apiResponse.Success = false;
                apiResponse.Message = err.Message;

                Exceptions.LogException(err);
            }

            return(Request.CreateResponse(HttpStatusCode.OK, apiResponse));
        }
コード例 #2
0
        public HttpResponseMessage ListModulesOnPage(int portalId, int tabId)
        {
            var apiResponse = new DTO.ApiResponse <List <DTO.GenericListItem> >();

            try
            {
                var mc = new DotNetNuke.Entities.Modules.ModuleController();
                apiResponse.CustomObject = new List <DTO.GenericListItem>();

                foreach (var tabModule in mc.GetTabModules(tabId))
                {
                    var newGenericItem = new DTO.GenericListItem();
                    newGenericItem.Name  = string.Format("{0} - {1} - {2}", string.IsNullOrWhiteSpace(tabModule.Value.ModuleTitle) ? "No Title" : tabModule.Value.ModuleTitle, tabModule.Value.PaneName, tabModule.Value.ModuleDefinition.FriendlyName);
                    newGenericItem.Value = tabModule.Value.ModuleID.ToString();
                    apiResponse.CustomObject.Add(newGenericItem);
                }

                apiResponse.Success = true;
            }
            catch (Exception err)
            {
                apiResponse.Success = false;
                apiResponse.Message = err.Message;

                Exceptions.LogException(err);
            }

            return(Request.CreateResponse(HttpStatusCode.OK, apiResponse));
        }