Beispiel #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));
        }
Beispiel #2
0
        public async Task <ServiceResult <Models.ContentManager.Category> > GetCategories([FromUri] ViewModel.UserBlog.GetCategoriesVM model)
        {
            try
            {
                var res = await ContentManagerRepository.GetUserCategories(model.userid);

                return(new ServiceResult <Category>
                {
                    Data = res,
                    ServiceResultStatus = (int)Rdio.Util.Common.ServiceResultStatus.OK,
                    ServiceResultMassage = Util.Common.ServiceResultMessage.OKMessage.ToString()
                });
            }
            catch (Exception ex)
            {
                return(new ServiceResult <Category>
                {
                    Data = null,
                    ServiceResultStatus = (int)Rdio.Util.Common.ServiceResultStatus.Error,
                    ServiceResultMassage = ex.GetBaseException().Message
                });
            }
        }