mirror of https://github.com/ErsatzTV/ErsatzTV.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
868 B
24 lines
868 B
using System.Collections.Generic; |
|
using System.Linq; |
|
using System.Threading; |
|
using System.Threading.Tasks; |
|
using ErsatzTV.Application.MediaItems; |
|
using ErsatzTV.Core.Interfaces.Repositories; |
|
using LanguageExt; |
|
using MediatR; |
|
using static ErsatzTV.Application.MediaItems.Mapper; |
|
|
|
namespace ErsatzTV.Application.Artists.Queries |
|
{ |
|
public class GetAllArtistsHandler : IRequestHandler<GetAllArtists, List<NamedMediaItemViewModel>> |
|
{ |
|
private readonly IArtistRepository _artistRepository; |
|
|
|
public GetAllArtistsHandler(IArtistRepository artistRepository) => _artistRepository = artistRepository; |
|
|
|
public Task<List<NamedMediaItemViewModel>> Handle( |
|
GetAllArtists request, |
|
CancellationToken cancellationToken) => |
|
_artistRepository.GetAllArtists().Map(list => list.Map(ProjectToViewModel).ToList()); |
|
} |
|
}
|
|
|