/// <summary>
        /// Does the search movie.
        /// </summary>
        /// <returns>The search movie.</returns>
        /// <param name="letter">Letter.</param>
        async Task DoSearchMovie(string letter)
        {
            if (string.IsNullOrEmpty(letter))
            {
                GetLocalMovieList();
                return;
            }

            var sorted = resultsService.GetAll().Where(x => x.OriginalTitle.ToLowerInvariant().Contains(letter.ToLowerInvariant()))
                         .ToList();

            try
            {
                if (sorted == null || !sorted.Any())
                {
                    sorted = await resultsService
                             .GetAllRemoteData(APIOperations.SearchMovieURLAddres, ConfigureParameters(APIOperations.SearchMovieURLAddres, 1, letter));

                    sorted = AddImageLinkAndRemoveRepeated(sorted);
                }

                Movies = new ObservableCollection <Results>(sorted);
            }
            catch (ConnectionException)
            {
                uiFunctionsService.HideLoading();
                uiFunctionsService.ShowToast(Constants.OfflineMessage, ToastType.Info, 8000);
            }
            catch (FetchRemoteDataException)
            {
                uiFunctionsService.ShowToast(Constants.GetOnlineDataErrorMessage, ToastType.Error, 8000);
                GetLocalMovieList();
            }
            catch
            {
                mobileCenterCrashesService.AskBeforeSendCrashReport();
                uiFunctionsService.ShowToast(Constants.GeneralErrorMessage, ToastType.Warning, 8000);
                GetLocalMovieList();
            }
            finally
            {
                analyticsFunctionsService.TrackEvent(AnalitycsEventsName.SearchMovie,
                                                     new Dictionary <string, string> {
                    { letter, sorted.Count.ToString() }
                });
            }
        }
Exemplo n.º 2
0
        public IActionResult Index()
        {
            var result = _procesoServices.GetAll();

            return(View(result));
        }