zoukankan      html  css  js  c++  java
  • C# 递归模型定义。赋值

    https://blog.csdn.net/wumiju/article/details/80429412

     public partial class ProductTypeModel:DbEntityModels.ProductType
        {
            public List<ProductTypeModel> SubProductTypeInfo { get; set; }

            
        }

      public IActionResult ListProductType()
            {
                List<Models.ProductTypeModel> listType = new List<Models.ProductTypeModel>();
              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 });
            }

            public List<Models.ProductTypeModel> subListProductType(long fid)
            {
                var dbProductTypeInfo = typeBll.Query(x => x.IsDelete == false && x.Fid == fid);
                List<Models.ProductTypeModel> listType = new List<Models.ProductTypeModel>();
                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;


            }

  • 相关阅读:
    TortoiseSVN 命令 (命令行执行工具)(转)
    express blend下载
    js绝对地址图片转换成base64的方法
    js判断是否安装flash player及当前版本 和 检查flash版本是否需要升级
    js实现默认或者触发一个事件选中元素内容的方法
    js实现复制功能,将需要复制的内容放入剪切板上
    前端js上传文件插件
    javascript检测浏览器的缩放状态实现代码 是指浏览器网页内容的百分比缩放(按Ctrl和+号键或者-号键的缩放)
    html5 canvas 画图移动端出现锯齿毛边的解决方法
    jquery实现全选/反选功能
  • 原文地址:https://www.cnblogs.com/LuoEast/p/9696879.html
Copyright © 2011-2022 走看看