using NEducation.Controllers; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace NEducation.Code { public class GrammarExample { public String id { get; set; } public String name { get; set; } public String description { get; set; } public String introduction { get; set; } public String picture { get; set; } public String content { get; set; } public String contentType { get; set; } public String grammarID { get; set; } // parse data from JSON data public GrammarExample() { } public GrammarExample(string json) : this(JObject.Parse(json)) { } public GrammarExample(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"]; 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"]; grammarID = (string)jObject["GRAMMAR_ID"]; } } } }