コード例 #1
0
ファイル: TrainController.cs プロジェクト: dalinhuang/newcqgj
        public ActionResult ShowClass(int id)
        {
            TrainShowClassViewData viewData = new TrainShowClassViewData();
            Classes classes = (from c in CQGJ.Classes
                               where c.ClassID == id
                               select c).First();
            ViewData["PlanID"] = (from c in CQGJ.Classes
                                  where c.ClassID == id
                                  select c.Plan.PlanID).First();
            viewData.Classes = classes;

            //学员列表
            viewData.UserList = (from s in CQGJ.Student
                                where s.Classes.ClassID == id
                                select s.User).ToList();
            //班级课程
            viewData.CourseList = (from cs in CQGJ.Course
                                   where cs.Classes.ClassID == id
                                   select cs).ToList();

            return View("ShowClass", viewData);
        }
コード例 #2
0
ファイル: TrainController.cs プロジェクト: dalinhuang/cqgj
        public void ShowClass(int id)
        {
            TrainShowClassViewData viewData = new TrainShowClassViewData();
            Classes classes = (from c in CQGJ.Classes
                               where c.ClassID == id
                               select c).First();
            viewData.Classes = classes;
            viewData.PhotoUrl = ConfigurationManager.AppSettings["PhotoUrl"].ToString();

            List<int> ListID = (from s in CQGJ.Student where s.Classes.ClassID == id select s.User.UserID).ToList();
            passport.CQGJPassport cqgjp = new CQGJ.passport.CQGJPassport();
            viewData.UserList = new List<CQGJ.passport.User>();
            for (int i = 0; i < ListID.Count; ++i)
            {
                ListID[i] = ToPassportUserID(ListID[i]);
                CQGJ.passport.User user = cqgjp.GetCQGJUser(ListID[i]);
                viewData.UserList.Add(user);
            }

            //班级课程
            viewData.CourseList = (from cs in CQGJ.Course
                                   where cs.Classes.ClassID == id
                                   select cs).ToList();

            RenderView("ShowClass", viewData);
        }