Ejemplo n.º 1
0
        public ActionResult GetDataByCategory(string itemCategory)
        {
            Dictionary <string, Dictionary <int, int> > itemInfo = RequestDao.GetRequestedItemNoByCategory(itemCategory);
            Dictionary <string, List <object> >         result   = new Dictionary <string, List <object> >();

            foreach (KeyValuePair <string, Dictionary <int, int> > kV in itemInfo)
            {
                List <object> itemMonthQtyList = new List <object>();
                foreach (KeyValuePair <int, int> kVNested in kV.Value)
                {
                    var obj = new
                    {
                        month = kVNested.Key,
                        qty   = kVNested.Value
                    };

                    itemMonthQtyList.Add(obj);
                }

                result.Add(kV.Key, itemMonthQtyList);
            }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }