Beispiel #1
0
        public void AddExam(Exams exam)
        {
            var examDb = _studentsOrgEntities.Exams;

            examDb.Add(exam);
            _studentsOrgEntities.SaveChanges();
        }
        public void AddSubject(Subjects subject)
        {
            var subjectsDb = _studentsOrgEntities.Subjects;

            subjectsDb.Add(subject);

            _studentsOrgEntities.SaveChanges();
        }
        public void AddAndSaveLearnCycle()
        {
            var learnTable = _studentsOrgEntities.LearningDays;

            var learnDay = new LearningDays()
            {
                subjectName        = _examName,
                learningTimeAmount = _learningTime
            };

            if (CheckIfLearnDayIsNotInTable())
            {
                learnTable.Add(learnDay);
            }

            _studentsOrgEntities.SaveChanges();
        }
Beispiel #4
0
        /// <summary>
        /// If learn time = 0 it will delete object from table.
        /// </summary>
        /// <param name="learnDay"></param>
        private void SubstractTime()
        {
            var learnTable  = _studentsOrgEntities.LearningDays;
            var learnObject = learnTable.Single(n => n.dayId == LearnDay.dayId);

            if (learnObject.learningTimeAmount > 0)
            {
                learnObject.learningTimeAmount--;
            }
            else
            {
                learnTable.Remove(learnObject);
            }

            _studentsOrgEntities.SaveChanges();
        }