using NEducation.Controllers; using Newtonsoft.Json.Linq; using System; using System.Web; namespace NEducation.Code { public class Vocabulary : PostObj { public String id { get; set; } public String nameGlobal { get; set; } public String nameLocal { get; set; } public String descriptionGlobal { get; set; } public String descriptionLocal { get; set; } public String introductionGlobal { get; set; } public String introductionLocal { get; set; } public String example { get; set; } public String spell { get; set; } public String content { get; set; } public String contentType { get; set; } public String picture { get; set; } public String lessonID { get; set; } // parse data from JSON data public Vocabulary() { } public Vocabulary(string json) : this(JObject.Parse(json)) { } public Vocabulary(JObject jObject) { if (jObject != null) { id = (string)jObject["ID"]; nameGlobal = (string)jObject["NAME_GLOBAL"]; nameLocal = (string)jObject["NAME_LOCAL"]; descriptionGlobal = (string)jObject["DESCRIPTION_GLOBAL"]; descriptionLocal = (string)jObject["DESCRIPTION_LOCAL"]; introductionGlobal = (string)jObject["INTRODUCTION_GLOBAL"]; introductionLocal = (string)jObject["INTRODUCTION_LOCAL"]; example = (string)jObject["EXAMPLE"]; spell = (string)jObject["SPELL"]; contentType = (string)jObject["CONTENT_TYPE"]; if (contentType == UtilsController.GetContentType.AUDIO_FILE || contentType == UtilsController.GetContentType.PICTURE_FILE || contentType == UtilsController.GetContentType.VIDEO_FILE) content = UtilsController.GetContentPath.VocabularyContentPath + (string)jObject["CONTENT"]; else content = (string)jObject["CONTENT"]; picture = UtilsController.GetContentPath.VocabularyContentPath + (string)jObject["PICTURE"]; lessonID = (string)jObject["LESSON_ID"]; System.Diagnostics.Debug.WriteLine("picture " + picture); } } } }