Exemple #1
0
        public void RemoveGrade(Predicate <Grade> p)
        {
            var gradeSatisfy = Grades.Where(p.Invoke).ToArray();

            foreach (var grade in gradeSatisfy)
            {
                Grades.Remove(grade);
            }

            Save();
            if (GradesChanged != null)
            {
                GradesChanged.Invoke();
            }
        }
Exemple #2
0
        public void EditGrade(Grade grade)
        {
            if (grade == null)
            {
                throw new ArgumentNullException();
            }

            foreach (var gradeInList in Grades.Where(gradeInList => gradeInList.Equals(grade)))
            {
                gradeInList.Mark = grade.Mark;
            }

            Save();
            if (GradesChanged != null)
            {
                GradesChanged.Invoke();
            }
        }
Exemple #3
0
        public void AddGrade(Grade grade)
        {
            if (grade == null)
            {
                throw new ArgumentNullException();
            }
            //Method List<T>.Contains(T obj) uses the overriden Equals methods for objects Grade and Course, therefore it is eligible
            if (Grades.Contains(grade))
            {
                throw new ArgumentException();
            }
            grade.Id = _idHolder++;
            Grades.Add(grade);

            Save();
            if (GradesChanged != null)
            {
                GradesChanged.Invoke();
            }
        }