Example #1
0
 public List <Course> Query(Expression <Func <Course, bool> > predicate)
 {
     using (CourseManagementEntities entity = new CourseManagementEntities())
     {
         List <Course> courseList = entity.Course.Where(predicate).ToList();
         return(courseList);
     }
 }
Example #2
0
        public List <Course> List()
        {
            using (CourseManagementEntities entity = new CourseManagementEntities())
            {
                var course = entity.Course.ToList();

                return(course);
            }
        }
Example #3
0
 public void Delete(Course course)
 {
     using (CourseManagementEntities entity = new CourseManagementEntities())
     {
         Course c = entity.Course.Where(x => x.Id == course.Id).Single();
         entity.Entry(c).State = EntityState.Deleted;
         entity.Course.Remove(c);
         entity.SaveChanges();
     }
 }
Example #4
0
        public Course Add(Course t)
        {
            using (CourseManagementEntities entity = new CourseManagementEntities())
            {
                Course c = entity.Course.Add(t);
                entity.SaveChanges();

                return(c);
            }
        }
Example #5
0
        public Course Update(Course course)
        {
            using (CourseManagementEntities entity = new CourseManagementEntities())
            {
                entity.Entry(course).State = EntityState.Modified;

                entity.SaveChanges();

                return(course);
            }
        }
 public ArticleRepository(CourseManagementEntities _context)
 {
     db = _context;
 }