コード例 #1
0
        public async Task <ActionResult> CategoryManage(string id)
        {
            var categoryModel = await ContentManagerRepository.CategoryInfo(id);

            var UserId         = Util.Common.My.id;
            var UserCategories = await ContentManagerRepository.GetUserCategories(UserId);

            var ParentTitle = string.Empty;

            if (string.IsNullOrWhiteSpace(categoryModel.userid))
            {
                categoryModel.userid = Util.Common.My.id;
            }

            if (!string.IsNullOrEmpty(categoryModel.parentId) && categoryModel.parentId != "-1")
            {
                ParentTitle = (await ContentManagerRepository.CategoryInfo(categoryModel.parentId)).title;
            }
            var model = new ViewModel.ContentManager.SimpleCategoryManageVM()
            {
                blocks        = categoryModel.blocks,
                parentId      = categoryModel.parentId,
                parenttitle   = ParentTitle,
                allblocks     = Util.Configuration.AllBlocks(),
                _id           = categoryModel._id,
                title         = categoryModel.title,
                allcategories = UserCategories,
                userId        = categoryModel.userid
            };

            return(View(model));
        }