This repository was archived by the owner on Jul 10, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +10
-41
lines changed Expand file tree Collapse file tree 3 files changed +10
-41
lines changed Original file line number Diff line number Diff line change @@ -41,49 +41,15 @@ public async Task<ActionResult<List<SearchResult>>> Search(SearchTerm term)
41
41
)
42
42
. ToListAsync ( ) ;
43
43
44
- var results = sessionResults . Select ( s => new SearchResult
44
+ var results = sessionResults . Select ( session => new SearchResult
45
45
{
46
46
Type = SearchResultType . Session ,
47
- Session = new SessionResponse
48
- {
49
- Id = s . Id ,
50
- Title = s . Title ,
51
- Abstract = s . Abstract ,
52
- StartTime = s . StartTime ,
53
- EndTime = s . EndTime ,
54
- TrackId = s . TrackId ,
55
- Track = new ConferenceDTO . Track
56
- {
57
- Id = s ? . TrackId ?? 0 ,
58
- Name = s . Track ? . Name
59
- } ,
60
- Speakers = s ? . SessionSpeakers
61
- . Select ( ss => new ConferenceDTO . Speaker
62
- {
63
- Id = ss . SpeakerId ,
64
- Name = ss . Speaker . Name
65
- } )
66
- . ToList ( )
67
- }
47
+ Session = session . MapSessionResponse ( )
68
48
} )
69
- . Concat ( speakerResults . Select ( s => new SearchResult
49
+ . Concat ( speakerResults . Select ( speaker => new SearchResult
70
50
{
71
51
Type = SearchResultType . Speaker ,
72
- Speaker = new SpeakerResponse
73
- {
74
- Id = s . Id ,
75
- Name = s . Name ,
76
- Bio = s . Bio ,
77
- WebSite = s . WebSite ,
78
- Sessions = s . SessionSpeakers ?
79
- . Select ( ss =>
80
- new ConferenceDTO . Session
81
- {
82
- Id = ss . SessionId ,
83
- Title = ss . Session . Title
84
- } )
85
- . ToList ( )
86
- }
52
+ Speaker = speaker . MapSpeakerResponse ( )
87
53
} ) ) ;
88
54
89
55
return results . ToList ( ) ;
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ public static ConferenceDTO.SessionResponse MapSessionResponse(this Session sess
17
17
Id = ss . SpeakerId ,
18
18
Name = ss . Speaker . Name
19
19
} )
20
- . ToList ( ) ,
20
+ . ToList ( ) ,
21
21
TrackId = session . TrackId ,
22
22
Track = new ConferenceDTO . Track
23
23
{
Original file line number Diff line number Diff line change @@ -33,9 +33,12 @@ public async Task<IActionResult> OnGetAsync(int id)
33
33
return RedirectToPage ( "/Index" ) ;
34
34
}
35
35
36
- var sessions = await _apiClient . GetSessionsByAttendeeAsync ( User . Identity . Name ) ;
36
+ if ( User . Identity . IsAuthenticated )
37
+ {
38
+ var sessions = await _apiClient . GetSessionsByAttendeeAsync ( User . Identity . Name ) ;
37
39
38
- IsInPersonalAgenda = sessions . Any ( s => s . Id == id ) ;
40
+ IsInPersonalAgenda = sessions . Any ( s => s . Id == id ) ;
41
+ }
39
42
40
43
var allSessions = await _apiClient . GetSessionsAsync ( ) ;
41
44
You can’t perform that action at this time.
0 commit comments