| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- using NEducation.Controllers;
- using Newtonsoft.Json.Linq;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- namespace NEducation.Code
- {
- public class Grammar
- {
- public String id { get; set; }
- public String name { get; set; }
- public String description { get; set; }
- public String introduction { get; set; }
- //public String example { get; set; }
- //public String content { get; set; }
- //public String contentType { get; set; }
- public String picture { get; set; }
- public String lessonID { get; set; }
- public List<GrammarExample> listGrammarExample { get; set; }
- // parse data from JSON data
- public Grammar() { }
- public Grammar(string json) : this(JObject.Parse(json))
- { }
- public Grammar(JObject jObject)
- {
- if (jObject != null)
- {
- id = (string)jObject["ID"];
- name = (string)jObject["NAME"];
- description = (string)jObject["DESCRIPTION"];
- introduction = (string)jObject["INTRODUCTION"];
- picture = UtilsController.GetContentPath.GrammarContentPath + (string)jObject["PICTURE"];
- lessonID = (string)jObject["LESSON_ID"];
- //contentType = (string)jObject["CONTENT_TYPE"];
- //if (contentType == UtilsController.GetContentType.AUDIO_FILE ||
- // contentType == UtilsController.GetContentType.PICTURE_FILE ||
- // contentType == UtilsController.GetContentType.VIDEO_FILE)
- // content = UtilsController.GetContentPath.GrammarContentPath + (string)jObject["CONTENT"];
- //else
- // content = (string)jObject["CONTENT"];
- var list = jObject["LIST_GRAMMAR_EX"];
- if (list != null && list.HasValues)
- {
- listGrammarExample = new List<GrammarExample>();
- JArray a = (JArray)list;
- foreach (JObject o in a.Children<JObject>())
- {
- listGrammarExample.Add(new GrammarExample(o));
- }
- }
- }
- }
- }
- }
|