C# 递归模型定义。赋值
2021-07-09 19:06
标签:als art sort 模型 for return date stty csdn https://blog.csdn.net/wumiju/article/details/80429412 public partial class ProductTypeModel:DbEntityModels.ProductType public IActionResult ListProductType() public List C# 递归模型定义。赋值 标签:als art sort 模型 for return date stty csdn 原文地址:https://www.cnblogs.com/LuoEast/p/9696879.html
{
public List
}
{
List
var info = typeBll.Query(x => x.IsDelete == false && x.Fid == 0 && x.Depth == 0);
foreach (var item in info)
{
listType.Add(new Models.ProductTypeModel()
{
ID = item.ID,
IsDelete = item.IsDelete,
Depth = item.Depth,
CreateDate = item.CreateDate,
Fid = item.Fid,
Remark = item.Remark,
Sort = item.Sort,
TypeName = item.TypeName,
SubProductTypeInfo= subListProductType(item.ID)
});
}
return Json(new { data = listType });
}
{
var dbProductTypeInfo = typeBll.Query(x => x.IsDelete == false && x.Fid == fid);
List
foreach (var item in dbProductTypeInfo)
{
listType.Add(new Models.ProductTypeModel()
{
ID = item.ID,
IsDelete = item.IsDelete,
Depth = item.Depth,
CreateDate = item.CreateDate,
Fid = item.Fid,
Remark = item.Remark,
Sort = item.Sort,
TypeName = item.TypeName,
SubProductTypeInfo = subListProductType(item.ID)
});
}
return listType;
}
下一篇:用c#实现文件的读取和系列操作