Пример #1
0
        public List <Dictionary <string, object> > getEquipments(HttpRequestMessage req)
        {
            var postedString = req.Content.ReadAsStringAsync().Result;
            //JArray v = JArray.Parse(postedString);
            dynamic d     = JObject.Parse(Convert.ToString(postedString));
            string  jobId = Convert.ToString(d.jobId);

            obj = new DSL();
            DataTable dt;

            dt = obj.getEquipments(jobId);
            JavaScriptSerializer serializer          = new JavaScriptSerializer();
            List <Dictionary <string, object> > rows = new List <Dictionary <string, object> >();
            Dictionary <string, object>         row;

            foreach (DataRow dr in dt.Rows)
            {
                row = new Dictionary <string, object>();
                foreach (DataColumn col in dt.Columns)
                {
                    row.Add(col.ColumnName, dr[col]);
                }
                rows.Add(row);
            }

            return(rows);
        }