コード例 #1
0
 public bool Add(Groups groups)
 {
     using (var dbContext = new SheduleEntities())
     {
         dbContext.Groups.Add(groups);
         dbContext.SaveChanges();
         return(true);
     }
 }
コード例 #2
0
 public bool Add(Lecturer lecturer)
 {
     using (var dbContext = new SheduleEntities())
     {
         dbContext.Lecturer.Add(lecturer);
         dbContext.SaveChanges();
         return(true);
     }
 }
コード例 #3
0
 public bool Add(Subject subject)
 {
     using (var dbContext = new SheduleEntities())
     {
         dbContext.Subject.Add(subject);
         dbContext.SaveChanges();
         return(true);
     }
 }
コード例 #4
0
 public bool Add(Student student)
 {
     using (var dbContext = new SheduleEntities())
     {
         dbContext.Student.Add(student);
         dbContext.SaveChanges();
         return(true);
     }
 }
コード例 #5
0
 public bool Add(Lesson lesson)
 {
     using (var dbContext = new SheduleEntities())
     {
         dbContext.Lesson.Add(lesson);
         dbContext.SaveChanges();
         return(true);
     }
 }
コード例 #6
0
 public bool Add(Audience audience)
 {
     using (var dbContext = new SheduleEntities())
     {
         dbContext.Audience.Add(audience);
         dbContext.SaveChanges();
         return(true);
     }
 }
コード例 #7
0
 public bool Update(Audience audience)
 {
     using (var dbContext = new SheduleEntities())
     {
         var old = dbContext.Audience.FirstOrDefault(s => s.Id == audience.Id);
         old.Number = audience.Number;
         dbContext.SaveChanges();
     }
     return(true);
 }
コード例 #8
0
 public bool Update(Groups groups)
 {
     using (var dbContext = new SheduleEntities())
     {
         var old = dbContext.Groups.FirstOrDefault(s => s.Id == groups.Id);
         old.Name = groups.Name;
         dbContext.SaveChanges();
     }
     return(true);
 }
コード例 #9
0
        public bool Delete(Lesson lesson)
        {
            using (var dbContext = new SheduleEntities())
            {
                var dbLesson = dbContext.Lesson.Where(x => x.Id == lesson.Id).FirstOrDefault();
                dbContext.Lesson.Remove(dbLesson);
                dbContext.SaveChanges();

                return(true);
            }
        }
コード例 #10
0
        public bool Delete(Student student)
        {
            using (var dbContext = new SheduleEntities())
            {
                var dbStudent = dbContext.Student.Where(x => x.Id == student.Id).FirstOrDefault();
                dbContext.Student.Remove(dbStudent);
                dbContext.SaveChanges();

                return(true);
            }
        }
コード例 #11
0
        public bool Delete(Groups groups)
        {
            using (var dbContext = new SheduleEntities())
            {
                var dbGroup = dbContext.Groups.Where(x => x.Id == groups.Id).FirstOrDefault();
                dbContext.Groups.Remove(dbGroup);
                dbContext.SaveChanges();

                return(true);
            }
        }
コード例 #12
0
 public bool Update(Student student)
 {
     using (var dbContext = new SheduleEntities())
     {
         var old = dbContext.Student.FirstOrDefault(s => s.Id == student.Id);
         old.FirstName    = student.FirstName;
         old.LastName     = student.LastName;
         old.Birth        = student.Birth;
         old.Group_number = student.Group_number;
         dbContext.SaveChanges();
     }
     return(true);
 }
コード例 #13
0
 public bool Update(Lecturer lecturer)
 {
     using (var dbContext = new SheduleEntities())
     {
         var old = dbContext.Lecturer.FirstOrDefault(s => s.Id == lecturer.Id);
         old.FirstName  = lecturer.FirstName;
         old.LastName   = lecturer.LastName;
         old.Reputation = lecturer.Reputation;
         old.Phone      = lecturer.Phone;
         dbContext.SaveChanges();
     }
     return(true);
 }
コード例 #14
0
 public bool Delete(Lecturer lecturer)
 {
     using (var dbContext = new SheduleEntities())
     {
         var dbLecturer = dbContext.Lecturer.Where(x => x.Id == lecturer.Id).FirstOrDefault();
         if (dbLecturer != null)
         {
             dbContext.Lecturer.Remove(dbLecturer);
             dbContext.SaveChanges();
         }
         return(true);
     }
 }
コード例 #15
0
 public bool DeleteReference(Subject subject)
 {
     using (var dbContext = new SheduleEntities())
     {
         var dblesson = dbContext.Lesson.Where(x => x.Subject == subject.Id).FirstOrDefault();
         if (dblesson != null)
         {
             dbContext.Lesson.Remove(dblesson);
             dbContext.SaveChanges();
         }
         return(true);
     }
 }
コード例 #16
0
 public bool Delete(Audience audience)
 {
     using (var dbContext = new SheduleEntities())
     {
         var dbAudience = dbContext.Audience.Where(x => x.Id == audience.Id).FirstOrDefault();
         if (dbAudience != null)
         {
             dbContext.Audience.Remove(dbAudience);
             dbContext.SaveChanges();
         }
         return(true);
     }
 }
コード例 #17
0
 public bool Update(Lesson lesson)
 {
     using (var dbContext = new SheduleEntities())
     {
         var old = dbContext.Lesson.FirstOrDefault(s => s.Id == lesson.Id);
         old.Subject        = lesson.Subject;
         old.Lecturer       = lesson.Lecturer;
         old.Audience       = lesson.Audience;
         old.Academic_group = lesson.Academic_group;
         old.Time           = lesson.Time;
         old.Day            = lesson.Day;
         old.Type           = lesson.Type;
         dbContext.SaveChanges();
     }
     return(true);
 }
コード例 #18
0
 public bool DeleteReference(Groups groups)
 {
     using (var dbContext = new SheduleEntities())
     {
         var dblesson  = dbContext.Lesson.Where(x => x.Academic_group == groups.Id).FirstOrDefault();
         var dbstudent = dbContext.Student.Where(x => x.Group_number == groups.Id).FirstOrDefault();
         if (dblesson != null)
         {
             dbContext.Lesson.Remove(dblesson);
         }
         if (dbstudent != null)
         {
             dbContext.Student.Remove(dbstudent);
             dbContext.SaveChanges();
         }
         return(true);
     }
 }