public ActionResult Index() { ViewBag.Title = "Classes"; var sectionService = new SectionDataService(); dynamic sections = sectionService.GetSections(SessionInfo.Current.AccessToken, SessionInfo.Current.UserId); var model = new SectionListViewModel {Sections = sections}; return View(model); }
public async Task<ActionResult> IndexAsync(int? limit, int? offset) { ViewBag.Title = "Classes"; var sectionService = new SectionDataService(); var sections = await sectionService.GetSectionsAsync(SessionInfo.Current.AccessToken, SessionInfo.Current.UserId, limit, offset) .ContinueWith(t => new SectionListViewModel { Sections = t.Result }); return View("Index", sections); }
public async Task<ActionResult> GetStudentsAsync(string sectionId, int? limit, int? offset, string view) { if (string.IsNullOrEmpty(sectionId)) { return RedirectToAction("IndexAsync"); } try { var sectionService = new SectionDataService(); return View("GetStudents", await sectionService.GetSectionStudentAssociationStudentListAsync(SessionInfo.Current.AccessToken, sectionId, limit, offset, view)); } catch(Exception ex) { Trace.TraceError(ex.Message); ViewBag.Error = ex.Message; return Content("No students found"); } }