public async Task <IActionResult> Index(int?id) { var categories = await _context.Category.ToListAsync(); ViewData["categories"] = categories; var search = "TOATE"; if (id != null) { search = categories.First(it => it.Id == id).Name; } ViewData["search"] = search; var details = await _context.DetailsRobotics(id); ViewData["allRobo"] = details; return(View()); }