Ejemplo n.º 1
0
        public async Task <IActionResult> GetWatchNext()
        {
            var record = await _watchNextReader.GetActiveWatchNext(_currentUserAccessor.CurrentUser.Id);

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

            return(Ok(FilmResponse.FromRecord(record)));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> GetFilm([FromRoute] long id)
        {
            var record = await _filmReader.GetFilmById(id);

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

            return(Ok(FilmResponse.FromRecord(record)));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> GetWatchedFilms(int page = 1, int pageSize = 5)
        {
            var count = await _filmReader.GetWatchedFilmCount(_currentUserAccessor.CurrentUser.Id);

            var records = await _filmReader.GetWatched(_currentUserAccessor.CurrentUser.Id, pageSize, (page - 1) *pageSize);

            return(Ok(PagedResponse <FilmResponse> .FromEnumerable(records, record => FilmResponse.FromRecord(record), page, pageSize, count)));
        }