Example #1
0
 public IEnumerable <Course> GetAllCourse()
 {
     using (var db = new ContosoDataDbContext())
     {
         return(db.Courses.ToList());
     }
 }
Example #2
0
 public IEnumerable <People> GetAllPeople()
 {
     using (var db = new ContosoDataDbContext())
     {
         return(db.People.ToList());
     }
 }
Example #3
0
 public Course GetCourseByTitle(string title)
 {
     using (var db = new ContosoDataDbContext())
     {
         return(db.Courses.Where(d => d.Title == title).Single());
     }
 }
Example #4
0
 public People GetPeopleByName(string FirstName)
 {
     using (var db = new ContosoDataDbContext())
     {
         return(db.People.Where(d => d.FirstName == FirstName).SingleOrDefault());
     }
 }
Example #5
0
 public Enrollments GetEnrollmentGrade(string Grade)
 {
     using (var db = new ContosoDataDbContext())
     {
         return(db.Enrollment.Where(d => d.Grade == Grade).SingleOrDefault());
     }
 }
Example #6
0
 public Courses GetCourseByName(string Title)
 {
     using (var db = new ContosoDataDbContext())
     {
         return(db.Course.Where(d => d.Title == Title).SingleOrDefault());
     }
 }
 public Enrollment GetEnrollmentByGrade(string grade)
 {
     using (var db = new ContosoDataDbContext())
     {
         return(db.Enrollments.Where(d => d.Grade == grade).FirstOrDefault());
     }
 }
Example #8
0
 public IEnumerable <Enrollments> GetAllEnrollment()
 {
     using (var db = new ContosoDataDbContext())
     {
         return(db.Enrollment.ToList());
     }
 }
Example #9
0
 public Course GetHighestCredit()
 {
     using (var db = new ContosoDataDbContext())
     {
         return(db.Courses.OrderByDescending(d => d.Credits).FirstOrDefault());
     }
 }
 public Enrollment GetEnrollmentById(int id)
 {
     using (var db = new ContosoDataDbContext())
     {
         return(db.Enrollments.Where(d => d.Id == id).FirstOrDefault());
     }
 }
Example #11
0
 public People GetPeopleByCity(string City)
 {
     using (var db = new ContosoDataDbContext())
     {
         return(db.People.Where(d => d.City == City).Single());
     }
 }
Example #12
0
 public People GetPeopleById(int id)
 {
     using (var db = new ContosoDataDbContext())
     {
         return(db.People.Where(d => d.Id == id).FirstOrDefault());
     }
 }
Example #13
0
 public Course GetCourseById(int id)
 {
     using (var db = new ContosoDataDbContext())
     {
         return(db.Courses.Where(d => d.Id == id).FirstOrDefault());
     }
 }
Example #14
0
 public void Create(People people)
 {
     using (var db = new ContosoDataDbContext())
     {
         db.People.Add(people);
         db.SaveChanges();
     }
 }
Example #15
0
 public Enrollments GetEnrollmentById(int id)
 {
     using (var db = new ContosoDataDbContext())
     {
         var result = db.Enrollment.Where(d => d.Id == id).FirstOrDefault();
         return(result);
     }
 }
Example #16
0
 public void Create(Enrollments enrollment)
 {
     using (var db = new ContosoDataDbContext())
     {
         db.Enrollment.Add(enrollment);
         db.SaveChanges();
     }
 }
Example #17
0
 public void Create(Course course)
 {
     using (var db = new ContosoDataDbContext())
     {
         db.Courses.Add(course);
         db.SaveChanges();
     }
 }
Example #18
0
 public Courses GetCourseById(int id)
 {
     using (var db = new ContosoDataDbContext())
     {
         var result = db.Course.Where(d => d.Id == id).FirstOrDefault();
         return(result);
     }
 }
 public DepartmentRepository(ContosoDataDbContext context) : base(context) //access base class constructor
 {
 }
Example #20
0
 public DepartmentRepository(ContosoDataDbContext context) : base(context)
 {
 }
Example #21
0
 protected Repository(ContosoDataDbContext context)
 {
     _dbContext = context;
 }