public JsonResult GetLearnTypeData() { IList <LearnTypeModel> learnList = new List <LearnTypeModel>(); using (PostDAC dac = new PostDAC()) { learnList = dac.GetLearnTypeList(); } var list = from parent in learnList select new { id = parent.Code, text = parent.CodeName, children = from child1 in parent.ChildList select new { id = child1.Code, text = child1.CodeName, children = from child2 in child1.ChildList select new { id = child2.Code, text = child2.CodeName } } }; return(Json(list)); }
public JsonResult QueryNewPost(string test) { using (PostDAC dac = new PostDAC()) { IList <NewPostModel> list = dac.GetTop5NewStudentPost(); int total = 2; int page = 1; int records = 2; var gridData = new { total, page, records, rows = (from obj in list select new { cell = new { UserId = obj.UserId, Sex = obj.Sex_Text, Area = obj.Area } }) }; return(Json(gridData)); } }
public JsonResult ToTeachPostSave(NewPostToTeachModel model) { using (PostDAC dac = new PostDAC()) { try { dac.SaveNewPost(model, userId); return(Json("SUCCESS")); } catch { return(Json("存檔失敗")); } } }