public async Task <IActionResult> Index(Guid?categoryId) { var languageId = HttpContext.Session.GetString(SystemConstant.DefaultLanguageId); if (TempData["result"] != null) { ViewBag.Success = TempData["result"]; } var categories = await _categoryService.GetAllCategories(); ViewBag.Categories = categories.Select(x => new SelectListItem() { Text = x.Name, Value = x.Id.ToString(), Selected = categoryId.HasValue && categoryId == x.Id }); var products = await _productSevice.GetAllProducts(languageId, categoryId); return(View(products)); }