dev
Last change
on this file since 2a9d9d1 was 2a9d9d1, checked in by Стојков Марко <mst@…>, 3 years ago |
Set correct answer for question by question owner
|
-
Property mode
set to
100644
|
File size:
953 bytes
|
Line | |
---|
1 | using FinkiChattery.Persistence.Context;
|
---|
2 | using FinkiChattery.Persistence.Models;
|
---|
3 | using FinkiChattery.Persistence.Repositories.Contracts;
|
---|
4 | using Microsoft.EntityFrameworkCore;
|
---|
5 | using System.Linq;
|
---|
6 | using System.Threading.Tasks;
|
---|
7 |
|
---|
8 | namespace FinkiChattery.Persistence.Repositories
|
---|
9 | {
|
---|
10 | public class TeacherRepo : Repository<Teacher>, ITeacherRepo
|
---|
11 | {
|
---|
12 | public TeacherRepo(ApplicationDbContext dbContext) : base(dbContext)
|
---|
13 | {
|
---|
14 | }
|
---|
15 |
|
---|
16 | public async Task<TeacherSelfDto> GetTeacherSelfDto(long applicationUserId)
|
---|
17 | {
|
---|
18 | return await DbSet
|
---|
19 | .AsNoTracking()
|
---|
20 | .Include(x => x.TeacherTeams).ThenInclude(x => x.Team)
|
---|
21 | .Where(x => x.ApplicationUserFk == applicationUserId)
|
---|
22 | .Select(x => new TeacherSelfDto(x.Uid, x.ApplicationUserFk, x.TeacherTeams.Select(y => new TeacherTeamDto(y.Team.Uid, y.Team.Name))))
|
---|
23 | .FirstOrDefaultAsync();
|
---|
24 | }
|
---|
25 | }
|
---|
26 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.