// GET: ArticleBoms public async Task <IActionResult> Index() { /* * var masterDBContext = _context.ArticleBoms * .Where(a => a.ArticleParentId == 1) * .Include(a => a.ArticleChild) * .Include(a => a.ArticleParent) * .ThenInclude(b => b.ArticleChilds).ToList().Where(a => 1 == 1); */ var masterDBContext = _context.Articles .Include(x => x.ArticleType) .Include(navigationPropertyPath: w => w.Operations) .Where(predicate: x => x.ArticleType.Name == MasterTableArticle.ARTICLE_PRODUCTS /* Equals("Product") */).ToList(); var articleList = new List <M_Article>(); foreach (var item in masterDBContext) { var article = await _context.GetArticleBomRecursive(article : item, articleId : item.Id); articleList.Add(item: article); } return(View(model: articleList)); }
// GET: ArticleBoms public async Task <IActionResult> Index() { /* * var masterDBContext = _context.ArticleBoms * .Where(a => a.ArticleParentId == 1) * .Include(a => a.ArticleChild) * .Include(a => a.ArticleParent) * .ThenInclude(b => b.ArticleChilds).ToList().Where(a => 1 == 1); */ var masterDBContext = _context.Articles.Include(w => w.WorkSchedules) .Where(a => a.Id == 1 || a.Id == 24).ToList(); var articleList = new List <Article>(); foreach (var item in masterDBContext) { var article = await _context.GetArticleBomRecursive(item, item.Id); articleList.Add(article); } return(View(articleList)); }