Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/FinkiChattery/FinkiChattery.Persistence/Repositories/Implementations/StudentRepo.cs

    r2a9d9d1 r7146ebb  
    11using FinkiChattery.Persistence.Context;
    22using FinkiChattery.Persistence.Models;
    3 using FinkiChattery.Persistence.Repositories.Contracts;
    43using Microsoft.EntityFrameworkCore;
    5 using System.Linq;
    64using System.Threading.Tasks;
    75
     
    1816            return await DbSet.FirstOrDefaultAsync(x => x.ApplicationUserFk == applicationUserFk);
    1917        }
    20 
    21         public async Task<StudentSelfDto> GetStudentSelfDto(long applicationUserFk)
    22         {
    23             return await DbSet
    24                 .AsNoTracking()
    25                 .Include(x => x.Questions)
    26                 .Include(x => x.StudentTeams).ThenInclude(x => x.Team)
    27                 .Where(x => x.ApplicationUserFk == applicationUserFk)
    28                 .Select(x => new StudentSelfDto(x.Uid,
    29                                                 x.ApplicationUserFk,
    30                                                 x.IndexNumber,
    31                                                 x.Reputation,
    32                                                 x.ImageUrl,
    33                                                 x.Questions.Select(y => new StudentQuestionDto(y.Uid, y.Title)),
    34                                                 x.StudentTeams.Select(y => new StudentTeamDto(y.Team.Uid, y.Team.Name))))
    35                 .FirstOrDefaultAsync();
    36         }
    3718    }
    3819}
Note: See TracChangeset for help on using the changeset viewer.