public ActionResult GetBrands(int categoryId) { var brandsOfCategory = productHandler.GetBrandsOfSelectedCategory(categoryId); var listOfBrands = new List <BrandViewModel>(); foreach (var b in brandsOfCategory) { listOfBrands.Add(new BrandViewModel { BrandId = b.BrandId, Name = b.Name }); } return(Json(listOfBrands, JsonRequestBehavior.AllowGet)); }