public ActionResult Detay(int? categoryId)
{
var categories = categoryService.CategoriesToList();
if (categoryId == null)
{
var products = productService.Products().ToList();
return RedirectToAction("Index");
}
else
{
var products = productService
.CategoryProducts((int) categoryId, 50)
.ToList();
var result = products.Where(a => a.CategoryId == categoryId);
return View(result);
}
}
I have Product Controller and this is my method for send products to view by category.
I want to check categoryId in my View
Like this;
@if(categoryId==1){//do this.}
But I cant reach categoryId how can I send that data and get data from view?