예제 #1
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Article = await _context.Article
                      .Include(a => a.Category)
                      .Include(a => a.ArticleParameters)
                      .Include(a => a.ArticlePictures)
                      .FirstOrDefaultAsync(m => m.ArticleId == id);

            ListParameters = await _context.ArticleParameter
                             .Include(a => a.Article)
                             .Include(a => a.Parameter)
                             .ThenInclude(a => a.ParentParameter)
                             .Where(a => a.ArticleId == id).GroupBy(a => a.Parameter.ParentParameter.ParentParameterId).ToListAsync();

            ArticleParameters = ListParameters.SelectMany(a => a).ToList();

            if (Article == null)
            {
                return(NotFound());
            }
            ViewData["CategoryId"] = new SelectList(_context.Set <Data.Category>(), "CategoryId", "CategoryName");

            ArticleId = Article.ArticleId;
            return(Page());
        }
예제 #2
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Category = await _context.Category.FirstOrDefaultAsync(m => m.CategoryId == id);

            ViewData["ParentParameters"] = new SelectList(_context.Set <Data.ParentParameter>(), "ParentParameterId", "ParentParameterName");

            ppIds = _context.CategoryParentParameter.Where(c => c.CategoryId == id).Select(d => d.ParentParameterId).ToList();
            foreach (var ppidsFE in ppIds)
            {
                ParentParameters = _context.ParentParameter.Where(c => c.ParentParameterId == ppidsFE).ToList();
                ParentParametersMain.Add(ParentParameters);
            }

            if (Category == null)
            {
                return(NotFound());
            }
            return(Page());
        }
예제 #3
0
 public IActionResult OnGet()
 {
     ViewData["ParentParameters"] = new SelectList(_context.Set <Data.ParentParameter>(), "ParentParameterId", "ParentParameterName");
     return(Page());
 }
예제 #4
0
 public IActionResult OnGet()
 {
     ViewData["CategoryId"] = new SelectList(_context.Set <Data.Category>(), "CategoryId", "CategoryName");
     parameters             = FindFirstParams();
     return(Page());
 }