public IActionResult Index() { try { string name = "Cars"; Categories category = _categoryServices.GetByName(name); CategoriesDto categoryResult = Mapper.Map <CategoriesDto>(category); return(View(categoryResult.Products)); } catch (Exception ex) { _logger.LogError(ex.Message); return(View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier })); } }