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)); }
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)); }
/// <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())); }
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)); }