Ejemplo n.º 1
0
        public PagedList <PublicApi.Poll> List(
            [Documentation("The group identifier.")]
            int groupId,
            [
                Documentation(Name = "IncludeSubGroups", Type = typeof(bool), Default = false),
                Documentation(Name = "AuthorUserId", Type = typeof(int), Description = "UserId of Author"),
                Documentation(Name = "PageIndex", Type = typeof(int), Default = 0, Description = "The page index."),
                Documentation(Name = "PageSize", Type = typeof(int), Default = 20, Description = "The number of polls to return in a single page."),
                Documentation(Name = "SortBy", Type = typeof(string), Default = "Date", Description = "The sorting mechanism. ToppPollsScore does not support IncludeSubGroups or AuthorUserId options.", Options = new string[] { "Date", "TopPollsScore" }),
                Documentation(Name = "SortOrder", Type = typeof(string), Options = new string[] { "ascending", "descending" }, Default = "descending")
            ]
            IDictionary options
            )
        {
            PublicApi.PollsListOptions query = new PublicApi.PollsListOptions();

            if (options != null)
            {
                if (options["IncludeSubGroups"] != null)
                {
                    query.IncludeSubGroups = Convert.ToBoolean(options["IncludeSubGroups"]);
                }

                if (options["AuthorUserId"] != null)
                {
                    query.AuthorUserId = Convert.ToInt32(options["AuthorUserId"]);
                }

                if (options["PageIndex"] != null)
                {
                    query.PageIndex = Convert.ToInt32(options["PageIndex"]);
                }

                if (options["PageSize"] != null)
                {
                    query.PageSize = Convert.ToInt32(options["PageSize"]);
                }

                if (options["SortBy"] != null)
                {
                    query.SortBy = options["SortBy"].ToString();
                }

                if (options["SortOrder"] != null)
                {
                    query.SortOrder = options["SortOrder"].ToString();
                }
            }

            return(PublicApi.Polls.List(groupId, query));
        }
Ejemplo n.º 2
0
        public PagedList<PublicApi.Poll> List(
            [Documentation("The group identifier.")]
            int groupId,
            [
            Documentation(Name="IncludeSubGroups", Type = typeof(bool), Default = false),
            Documentation(Name="AuthorUserId", Type = typeof(int), Description = "UserId of Author"),
            Documentation(Name="PageIndex", Type = typeof(int), Default = 0, Description = "The page index."),
            Documentation(Name="PageSize", Type=typeof(int), Default=20, Description="The number of polls to return in a single page."),
            Documentation(Name="SortBy", Type=typeof(string), Default="Date", Description="The sorting mechanism. ToppPollsScore does not support IncludeSubGroups or AuthorUserId options.", Options=new string[] { "Date", "TopPollsScore" }),
            Documentation(Name="SortOrder", Type = typeof(string), Options = new string[] { "ascending", "descending" }, Default="descending")
            ]
            IDictionary options
            )
        {
            PublicApi.PollsListOptions query = new PublicApi.PollsListOptions();

            if (options != null)
            {
                if (options["IncludeSubGroups"] != null)
                    query.IncludeSubGroups = Convert.ToBoolean(options["IncludeSubGroups"]);

                if (options["AuthorUserId"] != null)
                    query.AuthorUserId = Convert.ToInt32(options["AuthorUserId"]);

                if (options["PageIndex"] != null)
                    query.PageIndex = Convert.ToInt32(options["PageIndex"]);

                if (options["PageSize"] != null)
                    query.PageSize = Convert.ToInt32(options["PageSize"]);

                if (options["SortBy"] != null)
                    query.SortBy = options["SortBy"].ToString();

                if (options["SortOrder"] != null)
                    query.SortOrder = options["SortOrder"].ToString();
            }

            return PublicApi.Polls.List(groupId, query);
        }