File tree Expand file tree Collapse file tree
HwProj.CoursesService/HwProj.CoursesService.API/Services Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11using System . Linq ;
22using System . Threading . Tasks ;
3+ using System . Collections . Generic ;
34using AutoMapper ;
45using HwProj . CoursesService . API . Models ;
56using HwProj . CoursesService . API . Repositories . Groups ;
@@ -62,12 +63,11 @@ public async Task DeleteGroupAsync(long groupId)
6263
6364 public async Task UpdateAsync ( long groupId , Group updated )
6465 {
65- var existingGroupMates = await _groupMatesRepository
66- . FindAll ( cm => cm . GroupId == groupId )
67- . ToArrayAsync ( )
68- . ConfigureAwait ( false ) ;
66+ var groupMates = ( await _groupsRepository . GetGroupsWithGroupMatesAsync ( new [ ] { groupId } ) )
67+ . FirstOrDefault ( )
68+ . GroupMates ?? new List < GroupMate > ( ) ;
6969
70- foreach ( var groupMate in existingGroupMates )
70+ foreach ( var groupMate in groupMates )
7171 {
7272 await _groupMatesRepository . DeleteAsync ( groupMate . Id ) . ConfigureAwait ( false ) ;
7373 }
You can’t perform that action at this time.
0 commit comments