/// <summary> /// Checks to see if a student's state has changed. /// </summary> /// <param name="student"></param> public override void stateChangeCheck(Student student) { if (student.GradePointAverage >= UpperLimit) { student.GPAStateId = HonoursState.getInstance().GPAStateId; db.SaveChanges(); } if (student.GradePointAverage < LowerLimit) { student.GPAStateId = SuspendedState.getInstance().GPAStateId; db.SaveChanges(); } }
/// <summary> /// Retrives an instance of the HonoursState class. /// </summary> /// <returns></returns> public static HonoursState getInstance() { if (honoursState == null) { honoursState = db.HonoursStates.SingleOrDefault(); if (honoursState == null) { honoursState = new HonoursState(); db.HonoursStates.Add(honoursState); db.SaveChanges(); } } return(honoursState); }