Пример #1
0
        public ActionResult LeftTreeMenu()
        {
            var leftTreeMenuHtml = WebCache.GetLeftMenuCache(LoginUser);

            if (leftTreeMenuHtml == null)
            {
                if (LoginUser.IsAdmin)
                {
                    leftTreeMenuHtml = new ResourceBLL().GetLeftTreeMenu(null);
                }
                else
                {
                    var role = new RoleBLL().GetModel(i => i.ID == LoginUser.RoleID);
                    if (role != null && !string.IsNullOrEmpty(role.ResourceID))
                    {
                        var resourceIdArray = role.ResourceID.Split(',');
                        var resourceIdList = new List<int>();
                        foreach (var resourceId in resourceIdArray)
                        {
                            resourceIdList.Add(Convert.ToInt32(resourceId));
                        }

                        leftTreeMenuHtml = new ResourceBLL().GetLeftTreeMenu(resourceIdList);
                    }
                }
                WebCache.SetLeftMenuCache(LoginUser, leftTreeMenuHtml ?? "");
            }

            return Content(leftTreeMenuHtml);
        }