public string GetList(int page, int rows)
 {
     var total = 0;
     var category = new CategoryService().Get();
     var list = pService.GetList(page, rows, out total);
     foreach (var item in list)
     {
         item.CategoryId = category.FirstOrDefault(e => e.Id == item.CategoryId).Name;
     }
     return list.ToJson(total);
 }
 public ActionResult Index()
 {
     var categoryService = new CategoryService();
     ViewBag.categories = categoryService.Get();
     return View();
 }
 public ProductController()
 {
     categoryService = new CategoryService();
     productService = new ProductService();
 }
 public JsonResult GetCategoryName(string categoryId)
 {
     var category = new CategoryService().Get().FirstOrDefault(e => e.Id == categoryId).Name;
     return Json(new { name = category });
 }
 public string GetList(int page, int rows)
 {
     var list = new CategoryService().Get();
     return list.ToJson(list.Count);
 }