static void _DBInsertSentences(DataClassesDataContext db, ExampleSentence es, ewords word) { sentences insertone = new sentences { eword_id = word.eword_id, sentence = es.Sentence, chinese = es.Chinese }; db.sentences.InsertOnSubmit(insertone); }
static List <ExampleSentence> Get_Sentences(string wordid) { string path = "https://api.shanbay.com/bdc/example/?vocabulary_id={0}"; path = string.Format(path, wordid); HttpWebRequest hwr = WebRequest.CreateHttp(path); HttpWebResponse hwro = (HttpWebResponse)hwr.GetResponse(); StreamReader sr = new StreamReader(hwro.GetResponseStream()); JObject jobject = (JObject)JsonConvert.DeserializeObject(sr.ReadToEnd()); JToken token = jobject["data"]; var result = new List <ExampleSentence>(); foreach (var item in token) { ExampleSentence now = new ExampleSentence(item["translation"].ToString(), item["annotation"].ToString()); result.Add(now); } return(result); }