예제 #1
0
        public async Task <IActionResult> Info(string columnNum, string num)
        {
            var cm = await _columnService.GetModelByNum(columnNum);

            if (cm == null)
            {
                return(Error404());
            }

            var item = await _contentService.GetByItem(cm?.ModelTable.SqlTableName, num);

            if (item == null)
            {
                return(Error404());
            }

            var site = await _siteService.GetByNum(cm?.Column.SiteNum);

            if (site == null)
            {
                return(Error404());
            }

            return(await RenderInfo(site, cm?.Column, cm?.ModelTable, item));
        }
예제 #2
0
파일: CategoryService.cs 프로젝트: ntzw/cms
        public async Task <PageResponse> GetTreeTableData(string columnNum)
        {
            var columnModel = await _columnService.GetModelByNum(columnNum);

            if (columnModel == null)
            {
                return(PageResponse.Error("栏目未绑定模型"));
            }

            var data = await _dapper.GetByColumnNum(columnNum, columnModel?.ModelTable.SqlCategoryTableName);

            var columns = data as Category[] ?? data.ToArray();

            return(new PageResponse(await GetTreeTableData(columns.ToList(), ""), columns.Length));
        }
예제 #3
0
        /// <summary>
        /// 删除内容数据
        /// </summary>
        /// <param name="form"></param>
        /// <returns></returns>
        public async Task <HandleResult> Delete([FromBody] JObject form)
        {
            string columnNum = form["columnNum"].ToStr();

            if (!(form["ids"] is JArray ids) || ids.Count <= 0 || columnNum.IsEmpty())
            {
                return(HandleResult.Error("无效数据"));
            }

            var cm = await _columnService.GetModelByNum(columnNum);

            if (cm == null || cm?.ModelTable == null)
            {
                return(HandleResult.Error("无效参数"));
            }

            return(await _service.Delete(cm?.ModelTable.SqlTableName,
                                         ids.Select(temp => temp.ToInt()).ToList()));
        }
예제 #4
0
파일: ContentService.cs 프로젝트: ntzw/cms
        public async Task <dynamic> GetByNumAndColumn(string columnNum, string num)
        {
            var model = await _columnService.GetModelByNum(columnNum);

            if (model?.ModelTable == null)
            {
                return(null);
            }

            return(await GetByNum(model?.ModelTable.SqlTableName, num));
        }