// GET api//5
public HttpResponseMessage Get(int id)
{
DataTable dt = new DataTable();
dt.Columns.Add("ID");
dt.Columns.Add("Dept");
DataRow dr = dt.NewRow();
dr["ID"] = "32";
dr["Dept"] = "專案開發技術部";
dt.Rows.Add(dr);
string strJson = JsonConvert.SerializeObject(dt);
HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(strJson, Encoding.GetEncoding("UTF-8"), "application/json") };
return result;
}
网友评论