コード例 #1
0
        private ListInfo GetList(string key, bool update)
        {
            var    ctlLists  = new ListController();
            int    index     = key.IndexOf(":", StringComparison.Ordinal);
            string listName  = key.Substring(index + 1);
            string parentKey = Null.NullString;

            if (index > 0)
            {
                parentKey = key.Substring(0, index);
            }
            if (update)
            {
                ListName  = listName;
                ParentKey = parentKey;
            }
            return(ctlLists.GetListInfo(listName, parentKey, ListPortalID));
        }
コード例 #2
0
            public static ActionResult GetListInfo(string listName, int?portalId)
            {
                ActionResult actionResult = new ActionResult();

                try
                {
                    int pid = portalId ?? PortalSettings.Current.PortalId;
                    if (!PortalSettings.Current.UserInfo.IsSuperUser && PortalSettings.Current.PortalId != pid)
                    {
                        actionResult.AddError(HttpStatusCode.Unauthorized.ToString(), Components.Constants.AuthFailureMessage);
                    }

                    if (actionResult.IsSuccess)
                    {
                        ListController listController = new ListController();
                        System.Collections.Generic.IEnumerable <ListEntryInfo> entries = listController.GetListEntryInfoItems(listName, "", pid);
                        var response = new
                        {
                            Success = true,
                            listController.GetListInfo(listName, "", pid)?.EnableSortOrder,
                            Entries = entries.Select(t => new
                            {
                                t.EntryID,
                                t.Text,
                                t.Value,
                                t.SortOrder
                            }).OrderBy(x => x.SortOrder)
                        };
                        actionResult.Data = response;
                    }
                }
                catch (Exception exc)
                {
                    actionResult.AddError(HttpStatusCode.InternalServerError.ToString(), exc.Message);
                }
                return(actionResult);
            }