| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- using NEducation.Controllers;
- using Newtonsoft.Json.Linq;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- namespace NEducation.Code
- {
- public class Category
- {
- public String id { get; set; }
- public String code { get; set; }
- public String name { get; set; }
- public String description { get; set; }
- public String introduction { get; set; }
- public String iconPath { get; set; }
- public String logoPath { get; set; }
- public String serviceId { get; set; }
- public List<Course> listCourse { get; set; }
- // parse data from JSON data
- public Category() { }
- public Category(string json) : this(JObject.Parse(json))
- { }
- public Category(JObject jObject)
- {
- if (jObject != null)
- {
- id = (string)jObject["ID"];
- code = (string)jObject["CODE"];
- name = (string)jObject["NAME"];
- description = (string)jObject["DESCRIPTION"];
- introduction = (string)jObject["INTRODUCTION"];
- iconPath = UtilsController.GetContentPath.CategoryContentPath + (string)jObject["ICON_PATH"];
- logoPath = UtilsController.GetContentPath.CategoryContentPath + (string)jObject["LOGO_PAHT"];
- serviceId = (string)jObject["SERVICE_ID"];
- var list = jObject["LIST_COURSE"];
- if (list != null && list.HasValues)
- {
- listCourse = new List<Course>();
- JArray a = (JArray)list;
- foreach (JObject o in a.Children<JObject>())
- {
- listCourse.Add(new Course(o));
- }
- }
- }
- }
- }
- }
|