Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        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));
            }
        }
Ejemplo n.º 3
0
 public JsonResult ToTeachPostSave(NewPostToTeachModel model)
 {
     using (PostDAC dac = new PostDAC())
     {
         try
         {
             dac.SaveNewPost(model, userId);
             return(Json("SUCCESS"));
         }
         catch
         {
             return(Json("存檔失敗"));
         }
     }
 }