Ejemplo n.º 1
0
        public async Task <ModuleAction> GetAction_BlogAsync(string url, int blogCategory = 0, DateTime?StartDate = null, int Count = 0)
        {
            BlogConfigData config = await BlogConfigDataProvider.GetConfigAsync();

            QueryHelper query = new QueryHelper();

            if (string.IsNullOrWhiteSpace(url))
            {
                url = await BlogConfigData.GetCategoryCanonicalNameAsync(blogCategory);
            }
            else
            {
                url = ModulePermanentUrl;
                query.Add("BlogCategory", blogCategory.ToString());
            }
            string date = null;

            if (StartDate != null)
            {
                query.Add("StartDate", StartDate.ToString());
                date = Formatting.Date_Month_YYYY((DateTime)StartDate);
                if (StartDate >= DateTime.UtcNow)
                {
                    date = this.__ResStr("latest", "{0} - Latest", date);
                }
            }
            else
            {
                Count = 0;// must have a date for Count to be displayed
            }
            return(new ModuleAction(this)
            {
                Url = string.IsNullOrWhiteSpace(url) ? ModulePermanentUrl : url,
                QueryArgsDict = query,
                Image = "#Display",
                LinkText = Count != 0 ? this.__ResStr("countLink", "{0} ({1})", date, Count) : this.__ResStr("displayLink", "Blog"),
                MenuText = Count != 0 ? this.__ResStr("countMenu", "{0} ({1})", date, Count) : this.__ResStr("displayText", "Blog"),
                Tooltip = Count != 0 ? this.__ResStr("countTooltip", "Display blog entries starting {0}", date, Count) : this.__ResStr("displayTooltip", "Display the blog"),
                Legend = Count != 0 ? this.__ResStr("countLegend", "Displays the blog entries starting {0}", date, Count) : this.__ResStr("displayLegend", "Displays the blog"),
                Style = ModuleAction.ActionStyleEnum.Normal,
                Category = ModuleAction.ActionCategoryEnum.Read,
                Mode = ModuleAction.ActionModeEnum.Any,
                Location = ModuleAction.ActionLocationEnum.NoAuto,
            });
        }