0

My code to display productlist in .net identity for asp.net 4.5 webforms is shown bellow. I try to use this code in .net 4.0 and can not correct error about [RouteData] !

       public IQueryable<Product> GetProducts(
                    [QueryString("id")] int? categoryId,
                    [RouteData] string categoryName)
{
  var _db = new WingtipToys.Models.ProductContext();
  IQueryable<Product> query = _db.Products;

  if (categoryId.HasValue && categoryId > 0)
  {
    query = query.Where(p => p.CategoryID == categoryId);
  }

  if (!String.IsNullOrEmpty(categoryName))
  {
    query = query.Where(p =>
                        String.Compare(p.Category.CategoryName,
                        categoryName) == 0);
  }
  return query;
}

In .net 4.0, I can not correct error with [QueryString("id")] and [RouteData] as argument! please help

Karl-Henrik
  • 1,113
  • 1
  • 11
  • 17
  • Mayhaps [RouteData](http://msdn.microsoft.com/library/system.web.modelbinding.routedataattribute(v=vs.110).aspx) exists only in .net 4.5? – AgentFire May 23 '14 at 08:33
  • yes **RouteData** as a class property only exist in .net 4.5 , but i want a solution for similar code in .net 4.0 – Majid Hematian May 23 '14 at 14:46

0 Answers0