mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
FilterParentListFromMaintainerAdditionalLists()
This commit is contained in:
parent
5c98c85721
commit
2b0fdf3e5b
2 changed files with 21 additions and 1 deletions
|
|
@ -30,7 +30,8 @@ public async Task<ListDetailsDto> GetDetailsAsync(int id)
|
|||
return await filterListsDbContext.FilterLists
|
||||
.AsNoTracking()
|
||||
.ProjectTo<ListDetailsDto>()
|
||||
.FirstAsync(x => x.Id == id);
|
||||
.FirstAsync(x => x.Id == id)
|
||||
.FilterParentListFromMaintainerAdditionalLists();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FilterLists.Services.FilterListService
|
||||
{
|
||||
public static class FilterListServiceExtensions
|
||||
{
|
||||
public static async Task<ListDetailsDto> FilterParentListFromMaintainerAdditionalLists(
|
||||
this Task<ListDetailsDto> listDetailsDtos)
|
||||
{
|
||||
foreach (var maintainer in listDetailsDtos.Result.Maintainers)
|
||||
maintainer.AdditionalLists = maintainer.AdditionalLists
|
||||
.Where(additionalList =>
|
||||
additionalList.Id != listDetailsDtos.Result.Id)
|
||||
.ToList();
|
||||
return await listDetailsDtos;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue