public void OnGet(int id) { Course = _courseSerervice.GetCourseById(id); var groups = _courseSerervice.GetGroupForManageCourse(); ViewData["Groups"] = new SelectList(groups, "Value", "Text", Course.GroupId); List <SelectListItem> subgroup = new List <SelectListItem>() { new SelectListItem() { Text = "انتخاب کنید", Value = "" } }; subgroup.AddRange(_courseSerervice.GetSubGroupForManageCourse(Course.GroupId)); var subgroups = _courseSerervice.GetSubGroupForManageCourse(Course.GroupId); ViewData["SubGroups"] = new SelectList(subgroups, "Value", "Text", Course.SubGroup ?? 0); var teachers = _courseSerervice.GetTeachers(); ViewData["Teachers"] = new SelectList(teachers, "Value", "Text", Course.TeacherId); var levels = _courseSerervice.GetLevels(); ViewData["Levels"] = new SelectList(levels, "Value", "Text", Course.LevelId); var status = _courseSerervice.GetStatus(); ViewData["Statues"] = new SelectList(status, "Value", "Text", Course.StatusId); }
public void OnGet() { var groups = _courseSerervice.GetGroupForManageCourse(); ViewData["Groups"] = new SelectList(groups, "Value", "Text"); var subgroups = _courseSerervice.GetSubGroupForManageCourse(int.Parse(groups.First().Value)); ViewData["SubGroups"] = new SelectList(subgroups, "Value", "Text"); var teachers = _courseSerervice.GetTeachers(); ViewData["Teachers"] = new SelectList(teachers, "Value", "Text"); var levels = _courseSerervice.GetLevels(); ViewData["Levels"] = new SelectList(levels, "Value", "Text"); var status = _courseSerervice.GetStatus(); ViewData["Statues"] = new SelectList(status, "Value", "Text"); }