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.
23 lines
837 B
23 lines
837 B
using System.Collections.Generic; |
|
using System.Linq; |
|
using System.Threading; |
|
using System.Threading.Tasks; |
|
using ErsatzTV.Core.Interfaces.Repositories; |
|
using MediatR; |
|
using static ErsatzTV.Application.MediaItems.Mapper; |
|
|
|
namespace ErsatzTV.Application.MediaItems.Queries |
|
{ |
|
public class GetAllMediaItemsHandler : IRequestHandler<GetAllMediaItems, List<MediaItemViewModel>> |
|
{ |
|
private readonly IMediaItemRepository _mediaItemRepository; |
|
|
|
public GetAllMediaItemsHandler(IMediaItemRepository mediaItemRepository) => |
|
_mediaItemRepository = mediaItemRepository; |
|
|
|
public async Task<List<MediaItemViewModel>> Handle( |
|
GetAllMediaItems request, |
|
CancellationToken cancellationToken) => |
|
(await _mediaItemRepository.GetAll()).Map(ProjectToViewModel).ToList(); |
|
} |
|
}
|
|
|