public List <GradeReport> GetListGradeReports()
        {
            var listGradeReports = new List <GradeReport>();
            var gradeReportRepo  = new GradeReportRepo();
            var sectionRepo      = new SectionRepo();
            var myclass          = GetClassName();
            var mycourse         = GetCourseID();
            var section          = sectionRepo.GetSectionByClassCourse(myclass, mycourse);
            var num = GetNumGradeReport();

            if (section == null)
            {
                return(listGradeReports);
            }

            for (int i = 0; i < num; ++i)
            {
                int index  = i + 2;
                var report = new GradeReport();
                report.SectionID = section.ID;
                report.StudentID = data[index][1];
                report.Midterm   = double.Parse(data[index][3]);
                report.Final     = double.Parse(data[index][4]);
                report.Other     = double.Parse(data[index][5]);
                report.Total     = double.Parse(data[index][6]);
                listGradeReports.Add(report);
            }

            return(listGradeReports);
        }
 private void btnSaveSection_Click(object sender, RoutedEventArgs e)
 {
     if (DeletedGradeList != null)
     {
         foreach (var item in DeletedGradeList)
         {
             GradeRepo.Remove(item.SectionID);
         }
     }
     if (SectionsList != null)
     {
         foreach (var item in SectionsList)
         {
             if (item.isNew)
             {
                 SectionRepo.Insert(item);
             }
             else
             {
                 SectionRepo.Update(item);
             }
         }
     }
     RefreshList();
 }
Exemplo n.º 3
0
        public IActionResult GetById(long id)
        {
            var section = new SectionRepo(_context).GetSection(id);

            if (section == null)
            {
                return(NotFound());
            }

            return(Ok(new ObjectResult(section)));
        }
Exemplo n.º 4
0
        public IActionResult GetAll()
        {
            var sections = new SectionRepo(_context).GetAll();

            if (sections == null)
            {
                return(NotFound());
            }

            return(Ok(new ObjectResult(sections)));
        }
 private void RefreshList()
 {
     SectionsList = SectionRepo.GetAll();
 }
Exemplo n.º 6
0
 public SectionController()
 {
     sectionRepo = new SectionRepo();
 }