close
[HttpPost]
public JsonResult GetProductsJSONResult()
{
  ProductService service = new ProductService();
  var data = service.FetchAll();
 
  List<Dictionary<string, object>> ja = new List<Dictionary<string, object>>();
 
  foreach (var item in data)
  {
    Dictionary<string, object> jo = new Dictionary<string, object>();
 
    jo.Add("ProductID", item.ProductID);
    jo.Add("ProductName", item.ProductName);
    jo.Add("CategoryID", item.CategoryID);
    jo.Add("CategoryName", item.Category.CategoryName);
    jo.Add("SupplierID", item.SupplierID);
    jo.Add("CompanyName", item.Supplier.CompanyName);
 
    ja.Add(jo);
  }
  return Json(ja);
}
arrow
arrow
    全站熱搜
    創作者介紹

    Chill_Radio 發表在 痞客邦 留言(0) 人氣()