예제 #1
0
        public void AddStudentForLesson(string number, int id)
        {
            var studentLesson = new StudentLesson
            {
                LessonId  = id,
                StudentId = _studentRepository.Get(x => x.SchoolNumber == number).Id
            };

            _dbContext.StudentLessons.Add(studentLesson);
            _dbContext.SaveChanges();
        }
예제 #2
0
 public int SaveChanges()
 {
     try
     {
         // Transaction işlemleri burada ele alınabilir veya Identity Map kurumsal tasarım kalıbı kullanılarak
         // sadece değişen alanları güncellemeyide sağlayabiliriz.
         return(_dbContext.SaveChanges());
     }
     catch
     {
         // Burada DbEntityValidationException hatalarını handle edebiliriz.
         throw;
     }
 }