Exemplo n.º 1
0
        public async Task <IEnumerable <Course> > GetAllAsync()
        {
            var courses = await _studentSystemDbContext.Set <CourseEntity>()
                          .AsNoTracking()
                          .ToListAsync();

            return(_mapping.Map <IEnumerable <Course> >(courses));
        }
        public async Task <Student> GetStudentWithCoursesByEmailAsync(string email)
        {
            var student = await _studentSystemDbContext.Set <StudentEntity>()
                          .AsNoTracking()
                          .Include(x => x.Courses)
                          .SingleOrDefaultAsync(x => x.Email.Equals(email));

            return(_mapping.Map <Student>(student));
        }
 // Constructor
 public GenericRepository(StudentSystemDbContext context)
 {
     this.context = context;
     this.dbSet   = context.Set <TEntity>();
 }