public ActionResult CalculateMarks() { CourseListModel obmodel = new CourseListModel(); // obmodel.CourseListCollection = GetCourseList(); ////////// obmodel.CourseListCollection = GetCourseList(); obmodel.StudentListCollection = GetStudentIdList(); return(View(obmodel)); }
public async Task <ViewResult> Index() { //we may move it to some service, but if the logic is not complex - nothing bad to keep it in controller CourseListModel model = new CourseListModel { Courses = await _courseRepository.GetCourses() }; return(View(model)); }
public ActionResult List() { var model = new CourseListModel { Items = _courseRepository.Select(new Repository.Filter.CourseFilter { }) }; return(View(model)); }
private void init(ref CourseListModel coursesList) { var mappedCategoriesList = GetCategories(); coursesList.Categories = new SelectList(mappedCategoriesList, "Id", "Name"); var mappedTrainersList = GetTrainers(); coursesList.Trainers = new SelectList(mappedTrainersList, "Id", "Name"); }
public ActionResult CalculateMarks(FormCollection c) { CourseListModel obmodel = new CourseListModel(); obmodel.CourseListCollection = GetCourseList(); obmodel.StudentListCollection = GetStudentIdList(); // obmodel.CourseListCollection = GetStudentIdList(); // CourseListModel obmodel = new CourseListModel();///////////// if (c["addmarks"] != null) { string s = c["sidata"].ToString(); ViewBag.siddata = s; ViewBag.Msgss = "okk"; return(View(obmodel)); } if (c["savemarks"] != null) { MarksInputList mil = null; string sid1 = c["sidata"].ToString(); string str = c["marksdata"].ToString(); string[] splitstr = str.Split(','); int i = 0; bool flag = false; foreach (string ss1 in splitstr) { //= int.Parse(c["MarksInput"].ToString(); string cid = "c-" + ss1.ToString(); int marks = int.Parse(c[cid].ToString()); // string sid = "53"; mil = new MarksInputList(); mil.CourseId = cid.Substring(2); mil.StId = sid1; mil.MarksInput = marks; if (SaveMarks(mil)) { flag = true; } } if (flag == true) { ViewBag.msgg = "Marks saved..."; } else { ViewBag.msgg = "Not saving.."; } } // obmodel = new CourseListModel(); // obmodel.CourseListCollection = GetCourseList(); return(View(obmodel)); }
// GET: Admin/Course public ActionResult Index(string query = null, int?categoryId = null, int?trainerId = null) { var coursesListData = new CourseListModel(); init(ref coursesListData); var coursesList = courseService.ReadAll(query, trainerId, categoryId); var mappedCuorsesList = mapper.Map <List <CourseModel> >(coursesList); coursesListData.Courses = mappedCuorsesList; return(View(coursesListData)); }
public ActionResult ShowAll() { CourseListModel obmodel = new CourseListModel(); obmodel.CourseListCollection = GetCourseList(); if (TempData["Msg"] != null) { ////////ViewBag.Addmsg = "Yes"; ViewBag.Msg1 = "done"; ViewBag.Msg2 = "Updated.."; } return(View(obmodel)); }
public async Task <IActionResult> CourseList(int?id /**int searchYear**/) { IQueryable <Enrollment> enrollments = _context.Enrollment.AsQueryable(); /**if (searchYear != null) * { * enrollments = enrollments.Where(e => e.Year == searchYear); * }**/ enrollments = enrollments.Where(e => e.CourseId == id).Include(e => e.Student).Include(e => e.Course); var viewmodel = new CourseListModel { Enrollments = await enrollments.ToListAsync() }; return(View(viewmodel)); }
public static CourseListModel GetCourseList(String userName, String passWord) { CourseListModel courseListModel = new CourseListModel(); CookieContainer cookieStore = new CookieContainer(); List <CourseModel> courseList = new List <CourseModel>(); int index = 0; string postStr = "userName="******"&pwd=" + passWord + "&sb=sb"; string[] loginInfoLines = HttpRequest.Post("http://sep.ucas.ac.cn/slogin", postStr, cookieStore, Encoding.UTF8).Split('\n'); for (int i = 0; i < loginInfoLines.Length; i++) { if (loginInfoLines[i].Contains("当前用户所在单位")) { String str = loginInfoLines[i + 3].Trim(); courseListModel.Organization = str.Substring(2, str.Length - 2); courseListModel.Name = loginInfoLines[i + 6].Trim(); break; } } string urlRedirect = "http://sep.ucas.ac.cn/portal/site/226/821"; string respStr = HttpRequest.Get(urlRedirect, "", cookieStore, Encoding.UTF8); string[] temp = respStr.Split('\n'); string queryPath = ""; foreach (String line in temp) { if (line.Contains("url=")) { int firstPos = line.IndexOf("url=") + 4; int lastPos = line.LastIndexOf(">") - 1; queryPath = line.Substring(firstPos, lastPos - firstPos); break; } } HttpRequest.Get(queryPath, "", cookieStore, Encoding.UTF8); string respList = HttpRequest.Get("http://jwjz.ucas.ac.cn/Student/DeskTopModules/Course/CourseManage.aspx", "", cookieStore, Encoding.UTF8); string[] respLines = respList.Split('\n'); foreach (string line in respLines) { if (line.Contains("CourseTimeMsg.aspx?CourseID=")) { int firstPos = line.IndexOf("CourseTimeMsg.aspx?CourseID=") + 28; int lastPos = line.LastIndexOf("target=") - 2; string courseNum = line.Substring(firstPos, lastPos - firstPos); CourseModel courseModel = new CourseModel(); string[] courseListResp = HttpRequest.Get("http://jwjz.ucas.ac.cn/Student/DeskTopModules/Course/CourseTimeMsg.aspx?CourseID=" + courseNum, "", cookieStore, Encoding.UTF8).Split('\n'); int j = -1; string courseName = ""; foreach (string str in courseListResp) { if (str.Contains("#990000")) { int removePos = str.IndexOf("#990000"); String str2 = str.Substring(removePos, str.Length - removePos); int firstPos2 = str2.IndexOf(">") + 1; int lastPos2 = str2.IndexOf("<"); String content = str2.Substring(firstPos2, lastPos2 - firstPos2); if (j == -1) { courseName = content; } else if (j == 0) { courseModel = new CourseModel(); courseModel.Num = (courseNum); courseModel.Name = courseName; String[] grp = content.Split(':'); courseModel.Week = CourseModel.GetWeekIndex(grp[0].Trim()); String[] temp2 = (grp[1].Trim().Split('、')); courseModel.Time = temp2[0].Substring(1, temp2[0].Length - 1) + "-" + temp2[temp2.Length - 1].Substring(0, temp2[temp2.Length - 1].Length - 1); } else if (j == 1) { courseModel.Place = content; courseModel.Teacher = GetCourseTeacher(courseNum, cookieStore); } else { courseModel.Index = ++index; //String[] weekTemp = content.Split('、'); //List<Int32> weekList = new List<Int32>(); //for (int m = 0; m < weekTemp.Length; m++) //{ // weekList.Add(Int32.Parse(weekTemp[m])); //} //courseModel.WeekNum = weekList; courseModel.WeekNum = content; //人文讲座 已经过了的英语 等课程不算入课程表 if (courseModel.Place != null) { courseList.Add(courseModel); } } j = (++j) % 3; } } //string respJson=HttpRequest.Post("http://www.ishangke.net/getcourse.php", "cfgid=" + courseNum,cookieStore, Encoding.UTF8); //var json = Json.Decode(respJson); } } courseListModel.CourseInfoList = courseList; return(courseListModel); }
public CourseDetailModel() { coursemodel = new CourseListModel(); chapter = new List <ChapterAndFile>(); teachers = new List <CourseTeacherModel>(); }
public ActionResult ShowAll(FormCollection c) { CourseListModel obmodel = new CourseListModel(); obmodel.CourseListCollection = GetCourseList();////goTo method if (c["add"] != null) { ViewBag.Addmsg = "Yes"; return(View(obmodel)); } if (c["save"] != null) { CourseList cl = new CourseList(); cl.CourseId = c["cid1"].ToString().Substring(0, c["cid1"].ToString().Length - 1); cl.CourseName = c["cname1"].ToString().Substring(0, c["cname1"].ToString().Length - 1); cl.CourseMarks = int.Parse(c["cmarks1"].ToString()); if (SaveData(cl)) { TempData["Msg"] = "Info added.."; } else { TempData["Msg"] = "Error"; } return(RedirectToAction("ShowAll", "CourseDetails")); } if (c["show"] != null) { ViewBag.Addmsg1 = "ok"; return(View(obmodel)); } else if (c["Update"] != null) { string cid = c["cid1"].ToString(); string cname = c["cname1"].ToString(); int cmks = int.Parse(c["cmarks"].ToString()); if (UpdateMarks(cid, cname, cmks)) { //ViewBag.Msg = "Updated CourseInfo"; TempData["Msg"] = "Info added.."; } else { ViewBag.Msg = "Not Updatted"; } return(RedirectToAction("ShowAll", "CourseDetails")); } else if (c["Remove"] != null) { string idd = c["cid1"].ToString(); if (DeleteCourse(idd)) { ViewBag.Msg = "Deleted Course"; } else { ViewBag.Msg = "Not Deleted"; } return(RedirectToAction("ShowAll", "CourseDetails")); } return(View(obmodel)); }