public async Task <GetVideoByIdResponse> Handle(GetVideoByIdRequest request)
 {
     return(new GetVideoByIdResponse()
     {
         Video = VideoApiModel.FromVideo(await _dataContext.Videos.FindAsync(request.Id))
     });
 }
Exemplo n.º 2
0
 public async Task <GetVideoBySlugResponse> Handle(GetVideoBySlugRequest request)
 {
     return(new GetVideoBySlugResponse()
     {
         Video = VideoApiModel.FromVideo(await _dataContext.Videos.SingleAsync(x => x.Slug == request.Slug))
     });
 }
            public async Task <GetVideosResponse> Handle(GetVideosRequest request)
            {
                var videos = await _dataContext.Videos.ToListAsync();

                return(new GetVideosResponse()
                {
                    Videos = videos.Select(x => VideoApiModel.FromVideo(x)).ToList()
                });
            }