public ActionResult insertDegreesToStudent(student_degree SD, string status)
 {
     if (context.students.FirstOrDefault(s => s.student_ID == SD.student_ID) != null && context.courses.FirstOrDefault(c => c.course_code == SD.course_ID) != null && (SD.activites + SD.midterm + SD.practical <= 50) && (SD.activites + SD.final + SD.midterm + SD.practical <= 100))
     {
         student_degree newSD = new student_degree {
             student_ID = SD.student_ID, course_ID = SD.course_ID, final = SD.final, practical = SD.practical, midterm = SD.midterm, activites = SD.activites
         };
         newSD.GPA          = Convert.ToDecimal(CoursesFCI.CalGPA(Convert.ToDouble(newSD.activites + newSD.final + newSD.midterm + newSD.practical)));
         newSD.appreciation = CoursesFCI.CalAppreciation(Convert.ToDouble(newSD.GPA));
         context.student_degree.Add(newSD);
         context.SaveChanges();
         bool isSuccess = CoursesFCI.isSuccess(newSD.appreciation);
         if (isSuccess)
         {
             student_available_course RemoveCourse = context.student_available_course.FirstOrDefault(c => c.course_ID == newSD.course_ID);
             context.student_available_course.Remove(RemoveCourse);
             context.SaveChanges();
         }
         if (status == "true")
         {
         }
         return(RedirectToAction("../studentInformation/operationsucceeded"));
     }
     return(View("insertDegreesToStudent"));
 }
        public static void EndTerm(student_degree SD)
        {
            student_case_report SCR = new student_case_report()
            {
                student_ID = SD.student_ID, course_ID = SD.course_ID, appreciation = SD.appreciation, GPA = SD.GPA.Value, total_degree = (SD.midterm.Value + SD.practical.Value + SD.activites.Value + SD.final.Value)
            };

            context.student_case_report.Add(SCR);
            if (SD.student.student_term == 1)
            {
                //ممكن تطلع غلط
                SD.student.student_term++;
            }
            else
            {
                SD.student.student_level++;
            }
            context.SaveChanges();
        }