Engage.Dnn.Publish.Category.GetTopLevelCategories C# (CSharp) Method

GetTopLevelCategories() public static method

Returns a dataset of the top level categories available for a specific portal
public static GetTopLevelCategories ( int portalId ) : DataSet
portalId int The Portal ID that we want to return data for.
return System.Data.DataSet
        public static DataSet GetTopLevelCategories(int portalId)
        {
            string cacheKey = Utility.CacheKeyPublishTopLevelCategories + portalId.ToString(CultureInfo.InvariantCulture);
            DataSet ds;
            if (ModuleBase.UseCachePortal(portalId))
            {
                object o = DataCache.GetCache(cacheKey);
                if (o != null)
                {
                    ds = (DataSet)o;
                }
                else
                {
                    ds = DataProvider.Instance().GetTopLevelCategories(portalId);
                }

                if (ds != null)
                {
                    DataCache.SetCache(cacheKey, ds, DateTime.Now.AddMinutes(ModuleBase.CacheTimePortal(portalId)));
                    Utility.AddCacheKey(cacheKey, portalId);
                }
            }
            else
            {
                ds = DataProvider.Instance().GetTopLevelCategories(portalId);
            }

            return ds;
        }