Пример #1
0
        public String GradeStudent(String StudentId, int HomeworkId, int week, float grade, string feedback)
        {
            try
            {
                Student s = StudentRepo.FindOne(StudentId);
                if (s == null)
                {
                    return("Student not found.");
                }

                Homework h = HomeworkRepo.FindOne(HomeworkId);
                if (h == null)
                {
                    return("Homework not found.");
                }

                float finalGrade = h.ComputeGrade(grade, week);
                GradeRepo.Save(new Grade(StudentId, HomeworkId, week, finalGrade, feedback));
                return("Student graded " + finalGrade + ".");
            }
            catch (Exception e)
            {
                return(e.Message);
            }
        }