public override void stateChangeCheck(Student student) { if (student.GradePointAverage > UpperLimit) { student.GPAStateId = HonoursState.getInstance().GPAStateId; student.changeState(); } else if (student.GradePointAverage < LowerLimit) { student.GPAStateId = ProbationState.GetInstance().GPAStateId; student.changeState(); } }
/// <summary> /// gets an instance of Honourstate and populates it if it is null /// </summary> /// <returns></returns> public static HonoursState getInstance() { if (honoursState == null) { if (context.HonoursStates.SingleOrDefault() != null) { honoursState = context.HonoursStates.SingleOrDefault(); } else { context.HonoursStates.Add(new HonoursState()); context.SaveChanges(); } } return(honoursState); }