コード例 #1
0
        public ActionResult UpdateListEntryOrders(UpdateListEntryOrdersRequest request)
        {
            ActionResult actionResult = new ActionResult();

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

                if (actionResult.IsSuccess)
                {
                    ListController listController = new ListController();
                    for (int i = 0; i <= request.Entries.Length - 1; i++)
                    {
                        if (request.Entries[i].EntryId.HasValue)
                        {
                            ListEntryInfo entry = listController.GetListEntryInfo(request.Entries[i].EntryId.Value);
                            if (entry.SortOrder != request.Entries[i].SortOrder)
                            {
                                entry.SortOrder = request.Entries[i].SortOrder.Value;
                                Managers.MemberProfileManager.UpdateSortOrder(entry);
                                string cacheKey = string.Format(DataCache.ListEntriesCacheKey, pid, entry.ListName);
                                DataCache.RemoveCache(cacheKey);
                            }
                        }
                    }
                    DataCache.ClearListsCache(pid);
                }
            }
            catch (Exception exc)
            {
                actionResult.AddError(HttpStatusCode.InternalServerError.ToString(), exc.Message);
            }
            return(actionResult);
        }