mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
parent
e5e0cedc84
commit
7ff2b8e6f9
3 changed files with 20 additions and 3 deletions
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace FilterLists.Services.FilterListService
|
||||
{
|
||||
|
|
@ -13,6 +14,7 @@ public class FilterListDetailsDto
|
|||
public string ForumUrl { get; set; }
|
||||
public string HomeUrl { get; set; }
|
||||
public string IssuesUrl { get; set; }
|
||||
public IEnumerable<string> Languages { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string PolicyUrl { get; set; }
|
||||
public DateTime? PublishedDate { get; set; }
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
using System.Threading.Tasks;
|
||||
using AutoMapper.QueryableExtensions;
|
||||
using FilterLists.Data;
|
||||
using FilterLists.Data.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace FilterLists.Services.FilterListService
|
||||
|
|
@ -19,7 +18,7 @@ public FilterListService(FilterListsDbContext filterListsDbContext)
|
|||
|
||||
public async Task<IEnumerable<FilterListSummaryDto>> GetAllSummariesAsync()
|
||||
{
|
||||
return await filterListsDbContext.Set<FilterList>()
|
||||
return await filterListsDbContext.FilterLists
|
||||
.AsNoTracking()
|
||||
.OrderBy(x => x.Name)
|
||||
.ProjectTo<FilterListSummaryDto>()
|
||||
|
|
@ -28,7 +27,7 @@ public async Task<IEnumerable<FilterListSummaryDto>> GetAllSummariesAsync()
|
|||
|
||||
public async Task<FilterListDetailsDto> GetDetailsAsync(int id)
|
||||
{
|
||||
return await filterListsDbContext.Set<FilterList>()
|
||||
return await filterListsDbContext.FilterLists
|
||||
.AsNoTracking()
|
||||
.ProjectTo<FilterListDetailsDto>()
|
||||
.FirstAsync(x => x.Id == id);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
using System.Linq;
|
||||
using AutoMapper;
|
||||
using FilterLists.Data.Entities;
|
||||
|
||||
namespace FilterLists.Services.FilterListService
|
||||
{
|
||||
public class MappingProfiles : Profile
|
||||
{
|
||||
public MappingProfiles()
|
||||
{
|
||||
CreateMap<FilterList, FilterListDetailsDto>()
|
||||
.ForMember(d => d.Languages,
|
||||
opt => opt.MapFrom(c => c.FilterListLanguages.Select(x => x.Language.Name)));
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue