mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
feat(api): exclude soft-deleted FilterLists from API
This commit is contained in:
parent
599a9aa0d2
commit
20d4492f2f
1 changed files with 15 additions and 8 deletions
|
|
@ -1,4 +1,5 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using AutoMapper;
|
||||
using AutoMapper.QueryableExtensions;
|
||||
|
|
@ -15,14 +16,20 @@ public FilterListService(FilterListsDbContext dbContext, IConfigurationProvider
|
|||
{
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<FilterListDto>> GetAllAsync() =>
|
||||
await DbContext.FilterLists
|
||||
.ProjectTo<FilterListDto>(MapConfig)
|
||||
.ToListAsync();
|
||||
public async Task<IEnumerable<FilterListDto>> GetAllAsync()
|
||||
{
|
||||
return await DbContext.FilterLists
|
||||
.Where(fl => fl.IsDeleted != true)
|
||||
.ProjectTo<FilterListDto>(MapConfig)
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<FilterListDto> GetByIdAsync(int id) =>
|
||||
await DbContext.FilterLists
|
||||
.ProjectTo<FilterListDto>(MapConfig)
|
||||
.FirstOrDefaultAsync(l => l.Id == id);
|
||||
public async Task<FilterListDto> GetByIdAsync(int id)
|
||||
{
|
||||
return await DbContext.FilterLists
|
||||
.Where(fl => fl.IsDeleted != true)
|
||||
.ProjectTo<FilterListDto>(MapConfig)
|
||||
.FirstOrDefaultAsync(l => l.Id == id);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue