public async Task <ActionResult> GetClasses(int courseId, int semesterId) { SAMS.Models.AttendanceMaster param = new SAMS.Models.AttendanceMaster() { CourseId = courseId, SemesterId = semesterId, Day = (int)DateTime.Now.DayOfWeek }; //List<SAMS.Models.Timetable> list = await _repo.GetTimetable(param); List <SAMS.Models.Timetable> list = new List <Models.Timetable> { new Models.Timetable { Id = 1, ClassDetails = "Data Algorithms | 10:00-11:00 | Sunday" }, new Models.Timetable { Id = 1, ClassDetails = "Descrete Logics | 11:00-12:00 | Sunday" } }; var ddl = list.Select(a => new { Text = a.ClassDetails, Value = a.Id }).ToList(); return(Json(ddl, JsonRequestBehavior.AllowGet)); }
public async Task <JsonResult> GetTimetableList(int courseId, int semesterId) { try { SAMS.Models.AttendanceMaster param = new SAMS.Models.AttendanceMaster() { CourseId = courseId, SemesterId = semesterId, Day = DateTime.Now.DayOfWeek.ToInt() }; List <SAMS.Models.Timetable> list; //if (HttpContext.IsDebuggingEnabled) //{ // list = new List<Models.Timetable>() //{ // new Models.Timetable{Id=1, ClassDetails= "Data Algorithms | 10:00-11:00 | Sunday"}, // new Models.Timetable{Id=1, ClassDetails= "Descrete Logics | 11:00-12:00 | Sunday"} //}; //} //else list = await _repo.GetTimetable(param); var ddl = list.Select(a => new { Text = a.ClassDetails, Value = a.Id }).ToList(); return(Json(ddl, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(new { IsError = true, Message = ex.Message }, JsonRequestBehavior.AllowGet)); } }