public string GetExerciseData(int CourseID, string tagName, string selectedValue) { var Exercisedata = this.HWFilerepository.GetAll().Where(x => x.Course_ID == CourseID); int i = 0; Dictionary <string, string> optionData = new Dictionary <string, string>(); string keyText = string.Empty; foreach (var item in Exercisedata) { if (item.HW_Exam_Number.Contains("Exercise")) { keyText = string.Concat(item.HW_Exam_Number); if (optionData.Keys.Where(x => x == keyText).Count().Equals(0)) { optionData.Add(keyText, i.ToString()); i += 1; } } } if (string.IsNullOrWhiteSpace(tagName)) { tagName = "ClassName"; } string _html = DropDownListHelper.GetDropdownList(tagName, optionData, selectedValue, null, true, "選擇要批改之作業"); return(_html); }
public string GetTypes(int CourseID, string tagName, string selectedValue) { List <SelectListItem> HWorExerList = new List <SelectListItem>(); HWorExerList.AddRange(new[] { new SelectListItem() { Text = "HW_Exam", Value = "HW_Exam", Selected = false }, new SelectListItem() { Text = "Exercise", Value = "Exercise", Selected = false } }); var Typedata = HWorExerList; int i = 0; Dictionary <string, string> optionData = new Dictionary <string, string>(); string keyText = string.Empty; foreach (var item in Typedata) { keyText = string.Concat(item.Value.Trim()); if (optionData.Keys.Where(x => x == keyText).Count().Equals(0)) { optionData.Add(keyText, i.ToString()); i += 1; } } if (string.IsNullOrWhiteSpace(tagName)) { tagName = "assignmentType"; } string _html = DropDownListHelper.GetDropdownList(tagName, optionData, selectedValue, null, true, "選擇類型"); return(_html); }