using NEducation.Controllers; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace NEducation.Code { public class Course { public String id { get; set; } public String categoryId { get; set; } public String code { get; set; } public String name { get; set; } public String isLearn { get; set; } public String description { get; set; } public String introduction { get; set; } public String iconPath { get; set; } public String logoPath { get; set; } public List listLesson { get; set; } public Course() { } public Course(string json) : this(JObject.Parse(json)) { } public Course(JObject jObject) { if (jObject != null) { id = (string)jObject["ID"]; code = (string)jObject["CODE"]; name = (string)jObject["NAME"]; isLearn = (string)jObject["IS_LEARN"]; categoryId = (string)jObject["CATEGORY_ID"]; description = (string)jObject["DESCRIPTION"]; introduction = (string)jObject["INTRODUCTION"]; iconPath = UtilsController.GetContentPath.CourseContentPath + (string)jObject["ICON_PATH"]; logoPath = UtilsController.GetContentPath.CourseContentPath + (string)jObject["LOGO_PAHT"]; var list = jObject["LIST_LESSON"]; if (list != null && list.HasValues) { listLesson = new List(); JArray a = (JArray)list; foreach (JObject o in a.Children()) { listLesson.Add(new Lesson(o)); } } } } } }