Example #1
0
        public ActionResult <DeletePageDataOutput> DeletePageData([FromBody] DeletePageDataInput input)
        {
            if (!IsCanManage(input.PageName))
            {
                throw new Abp.Authorization.AbpAuthorizationException("未授权操作");
            }

            return(_pageDataManageAppService.DeletePageData(input));
        }
        public DeletePageDataOutput DeletePageData(DeletePageDataInput input)
        {
            var page = _repository.GetAllIncluding(e => e.PageDatas).FirstOrDefault(e => e.Name == input.PageName);

            var pageData = page.PageDatas.FirstOrDefault(e => e.Name == input.Name);

            page.PageDatas.Remove(pageData);

            return(new DeletePageDataOutput());
        }
Example #3
0
        /// <summary>
        /// 删除文章
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public DeletePageDataOutput DeletePageData(DeletePageDataInput input)
        {
            var pageData = _pageDataManager.PostRepository.FirstOrDefault(e => e.Name == input.Name && e.PageName == input.PageName);

            if (pageData == null)
            {
                throw new UserFriendlyException("找不到要删除的文章");
            }

            _deletePageDataService.DeletePageData(pageData);

            return(new DeletePageDataOutput());
        }
        public ActionResult <DeletePageDataOutput> DeletePageData([FromBody] DeletePageDataInput input)
        {
            if (_checkPermissionService.IsAllowAccess(ApiScopeProvider.Page, false, GetUserPermissions()))
            {
                return(_pageDataManageAppService.DeletePageData(input));
            }

            if (_pageManager.IsCanManagePost(input.PageName, GetUserPermissions()))
            {
                return(_pageDataManageAppService.DeletePageDataOfCreator(input));
            }

            throw new Abp.Authorization.AbpAuthorizationException("未授权操作");
        }
Example #5
0
        /// <summary>
        /// 创造者删除文章
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public DeletePageDataOutput DeletePageDataOfCreator(DeletePageDataInput input)
        {
            var pageData = _pageDataManager.PostRepository.FirstOrDefault(e => e.Name == input.Name && e.PageName == input.PageName);

            if (pageData == null)
            {
                throw new UserFriendlyException("找不到要删除的文章");
            }

            var editor = _userManager.GetUser((int)_abpSession.UserId.Value);

            _deletePageDataService.DeletePageDataOfCreator(pageData, editor);

            return(new DeletePageDataOutput());
        }
Example #6
0
        public DeletePageDataOutput DeletePageData(DeletePageDataInput input)
        {
            _pageDataManager.DeletePageData(input.PageName, input.Name);

            return(new DeletePageDataOutput());
        }