Exemplo n.º 1
0
        public async Task <IActionResult> ComponentIndexForType(int selectedComponentTypeId)
        {
            var viewModel = new ComponentIndexViewModel()
            {
                ComponentTypes          = await _context.ComponentType.ToListAsync(),
                Components              = await _context.Component.Where(x => x.ComponentTypeIdsList.Contains(selectedComponentTypeId)).ToListAsync(),
                SelectedComponentTypeId = _context.ComponentType.FirstOrDefaultAsync(x => x.ComponentTypeId == selectedComponentTypeId).Result.ComponentTypeId
            };

            return(View("ComponentsIndex", viewModel));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> ComponentsIndex()
        {
            var viewModel = new ComponentIndexViewModel()
            {
                Components              = await _context.Component.ToListAsync(),
                ComponentTypes          = await _context.ComponentType.ToListAsync(),
                SelectedComponentTypeId = _context.ComponentType.FirstOrDefaultAsync(x => x.ComponentName == "All").Result.ComponentTypeId
            };

            return(View(viewModel));
        }