Exemplo n.º 1
0
        public async Task <IActionResult> SectionReport(string sectionName, string assignment)
        {
            var assignments = await AssignmentService.GetAssignmentsAsync(ClassroomName);

            var assignmentGroups = assignments.GroupBy(a => a.GroupName)
                                   .OrderBy
                                   (
                g => g.Max
                (
                    a => a.DueDates.Count > 0 ? a.DueDates.Max(d => d.DueDate) : DateTime.MinValue
                )
                                   )
                                   .Select(g => g.Key)
                                   .ToList();

            ViewBag.SectionNames = new List <SelectListItem>
                                   (
                Classroom.Sections.OrderBy(s => s.Name).Select
                (
                    section => new SelectListItem()
            {
                Text     = section.DisplayName,
                Value    = section.Name,
                Selected = (sectionName == section.Name)
            }
                )
                                   );

            ViewBag.AssignmentGroups = new List <SelectListItem>
                                       (
                assignmentGroups.Select
                (
                    groupName => new SelectListItem()
            {
                Text     = groupName,
                Value    = groupName,
                Selected = (assignment == groupName)
            }
                )
                                       )
                                       .OrderBy(s => s.Text, new NaturalComparer())
                                       .Union
                                       (
                new[]
            {
                new SelectListItem()
                {
                    Text     = "All Recently Updated",
                    Value    = AllRecentlyUpdated,
                    Selected = (assignment == null)
                }
            }
                                       );

            ViewBag.GradebookNames = new List <SelectListItem>
                                     (
                Classroom.ClassroomGradebooks.Select
                (
                    classroomGradebook => new SelectListItem()
            {
                Text  = classroomGradebook.Name,
                Value = classroomGradebook.Name
            }
                )
                                     );

            return(View("SelectSectionReport"));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Admin()
        {
            var assignments = await AssignmentService.GetAssignmentsAsync(ClassroomName);

            return(View(assignments));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> GetAssignemntsAsync(long courseId)
        {
            var result = await _assignmentService.GetAssignmentsAsync(courseId);

            return(Json(result));
        }