Beispiel #1
0
        public async Task <IActionResult> Overview(Guid identifier)
        {
            var viewedItems = await _netflixViewedItemRepository.GetByGuidAsync(identifier);

            if (!viewedItems?.Any() ?? true)
            {
                return(RedirectToAction("NoResults"));
            }

            var playbacks =
                NetflixViewingHistoryLoader.GetNetflixPlaybacksFromViewingActivity(
                    _mapper.Map <List <NetflixViewedItem> >(viewedItems));

            var viewModel = _netflixStatsCreator.GetNetflixStatsViewModel(playbacks);

            viewModel.Identifier = identifier;

            var queryResult = await _queryResultRepository.GetByGuidWithoutViewedItemsAsync(identifier);

            viewModel.ResultsAreKept           = queryResult.KeepResults;
            viewModel.IsPublishedToLeaderboard = queryResult.IsPublishedToLeaderboard;
            viewModel.QueryDateTime            = queryResult.QueryDateTime;
            viewModel.ForProfile = queryResult.ForProfile;

            return(View("Index", viewModel));
        }
Beispiel #2
0
        public async Task <IActionResult> GetPlaybacksForIdentifierOnDate(Guid identifier, DateTime forDate)
        {
            var viewedItems = await _netflixViewedItemRepository.GetByGuidForDayAsync(identifier, forDate);

            var playbacks =
                NetflixViewingHistoryLoader.GetNetflixPlaybacksFromViewingActivity(
                    _mapper.Map <List <NetflixViewedItem> >(viewedItems));

            return(PartialView("Partials/_PlaybacksPartial", _netflixStatsCreator.GetNetflixPlaybacksViewModel(playbacks)));
        }