Beispiel #1
0
        public ActionResult Edit(int id = 0)
        {
            Teacher model  = new Teacher();
            string  action = "添加导师";

            if (id > 0)
            {
                model  = _teacherService.GetByIdAsync(id);
                action = "修改导师";
            }

            ViewBag.Action = action;

            List <SelectListItem>  divisionList = new List <SelectListItem>();
            IEnumerable <Division> divisions    = _divisionService.GetAllAsync();

            foreach (var item in divisions)
            {
                divisionList.Add(new SelectListItem {
                    Text = item.Name, Value = item.Id.ToString()
                });
            }
            ViewBag.divisionList = divisionList;

            List <SelectListItem> schoolList = new List <SelectListItem>();
            IEnumerable <School>  schools    = _schoolService.GetAllAsync();

            foreach (var item in schools)
            {
                schoolList.Add(new SelectListItem {
                    Text = item.Name, Value = item.Id.ToString()
                });
            }
            ViewBag.SchoolList = schoolList;

            List <SelectListItem> majorList = new List <SelectListItem>();
            IEnumerable <Major>   majors    = _majorService.GetAllAsync();

            foreach (var item in majors)
            {
                majorList.Add(new SelectListItem {
                    Text = item.Name, Value = item.Id.ToString()
                });
            }
            ViewBag.MajorList = majorList;
            return(View(model));
        }
Beispiel #2
0
        public ActionResult MajorSelect(int id = 0)
        {
            IEnumerable <Major>       majorList    = (_majorService.GetAllAsync()) ?? new List <Major>();
            IEnumerable <SchoolMajor> selectedList = (_schoolService.GetMajorsByIdAsync(id)) ?? new List <SchoolMajor>();
            List <Major> majorBkList  = new List <Major>();
            List <Major> majorYjsList = new List <Major>();

            foreach (var major in majorList)
            {
                major.IsSelected = false;
                foreach (var item in selectedList)
                {
                    if (item.MajorId == major.Id)
                    {
                        major.IsSelected = true;
                        major.SchoolInfo = item.Introduce;
                        break;
                    }
                }

                if (major.Type == Instart.Models.Enums.EnumMajorType.BengKe)
                {
                    majorBkList.Add(major);
                }
                else if (major.Type == Instart.Models.Enums.EnumMajorType.YanJiuSheng)
                {
                    majorYjsList.Add(major);
                }
            }
            var school = _schoolService.GetByIdAsync(id);

            if (school == null)
            {
                throw new Exception("艺术院校不存在");
            }
            ViewBag.MajorBkList  = majorBkList;
            ViewBag.MajorYjsList = majorYjsList;
            ViewBag.SchoolId     = id;
            ViewBag.SchoolName   = school.Name;
            return(View());
        }
Beispiel #3
0
        public ActionResult Edit(int id = 0)
        {
            Course model  = new Course();
            string action = "添加课程";

            if (id > 0)
            {
                model  = _courseService.GetByIdAsync(id);
                action = "修改课程";
            }

            ViewBag.Action = action;

            List <SelectListItem>      systemList    = new List <SelectListItem>();
            IEnumerable <CourseSystem> courseSystems = _courseSystemService.GetAllAsync() ?? new List <CourseSystem>();

            foreach (CourseSystem item in courseSystems)
            {
                systemList.Add(new SelectListItem {
                    Text = item.Name, Value = item.Id.ToString()
                });
            }
            ViewBag.systemList = systemList;

            List <SelectListItem> majorList = new List <SelectListItem>();
            IEnumerable <Major>   majors    = _majorService.GetAllAsync() ?? new List <Major>();

            foreach (Major item in majors)
            {
                majorList.Add(new SelectListItem {
                    Text = item.Name, Value = item.Id.ToString()
                });
            }
            ViewBag.majorList = majorList;
            return(View(model));
        }
        public ActionResult Edit(int id = 0)
        {
            Works  model  = new Works();
            string action = "添加作品";

            if (id > 0)
            {
                model  = _worksService.GetByIdAsync(id);
                action = "修改作品";
            }
            ViewBag.Action = action;

            List <SelectListItem> majorList = new List <SelectListItem>();
            IEnumerable <Major>   majors    = _majorService.GetAllAsync();

            foreach (var item in majors)
            {
                majorList.Add(new SelectListItem {
                    Text = item.Name, Value = item.Id.ToString()
                });
            }
            ViewBag.majorList = majorList;
            return(View(model));
        }
        public ActionResult Edit(int id = 0)
        {
            Student model  = new Student();
            string  action = "添加学员";

            if (id > 0)
            {
                model  = _studentService.GetByIdAsync(id);
                action = "修改学员";
            }

            ViewBag.Action = action;

            List <SelectListItem> schoolList = new List <SelectListItem>();
            IEnumerable <School>  schools    = _schoolService.GetAllAsync();

            foreach (var item in schools)
            {
                schoolList.Add(new SelectListItem {
                    Text = item.Name, Value = item.Id.ToString()
                });
            }
            ViewBag.SchoolList = schoolList;

            List <SelectListItem> teacherList = new List <SelectListItem>();
            IEnumerable <Teacher> teachers    = _teacherService.GetAllAsync();

            foreach (var item in teachers)
            {
                teacherList.Add(new SelectListItem {
                    Text = item.Name, Value = item.Id.ToString()
                });
            }
            ViewBag.TeacherList = teacherList;

            List <SelectListItem> majorList = new List <SelectListItem>();
            IEnumerable <Major>   majors    = _majorService.GetAllAsync();

            foreach (var item in majors)
            {
                majorList.Add(new SelectListItem {
                    Text = item.Name, Value = item.Id.ToString()
                });
            }
            ViewBag.MajorList = majorList;

            List <SelectListItem>  divisionList = new List <SelectListItem>();
            IEnumerable <Division> divisions    = _divisionService.GetAllAsync();

            foreach (var item in divisions)
            {
                divisionList.Add(new SelectListItem {
                    Text = item.Name, Value = item.Id.ToString()
                });
            }
            ViewBag.DivisionList = divisionList;

            List <SelectListItem> campusList = new List <SelectListItem>();
            IEnumerable <Campus>  campuses   = _campusService.GetAllAsync();

            foreach (var item in campuses)
            {
                campusList.Add(new SelectListItem {
                    Text = item.Name, Value = item.Id.ToString()
                });
            }
            ViewBag.CampusList = campusList;
            return(View(model));
        }