Ejemplo n.º 1
0
    public async Task <ActionResult <MawApi.ViewModels.Videos.VideoViewModel> > GetByIdAsync(short id)
    {
        var video = await _svc.GetVideoAsync(id, User.GetAllRoles());

        if (video == null)
        {
            return(NotFound());
        }

        return(_adapter.Adapt(video));
    }
    public async Task <ActionResult <ApiCollectionResult <MawApi.ViewModels.Videos.VideoViewModel> > > GetVideos(short id)
    {
        var photos = await _svc.GetVideosInCategoryAsync(id, User.GetAllRoles());

        if (photos == null)
        {
            return(NotFound());
        }

        var results = _videoAdapter.Adapt(photos);

        return(new ApiCollectionResult <VideoViewModel>(results.ToList()));
    }