public async Task Init(int lekarskoUverenjeId)
        {
            if (!Auth.IsAuthenticated())
            {
                NotificationService.Instance.Error(AppResources.UnauthenticatedAccessMessage);
                return;
            }

            _apiService.ChangeRoute(Routes.LekarskoUverenjeRoute);
            var getLekarskoUverenjeResult =
                await _apiService.GetById <LekarskoUverenjeDtoEL>(lekarskoUverenjeId, eagerLoaded : true);

            if (!getLekarskoUverenjeResult.Succeeded || !getLekarskoUverenjeResult.HasData)
            {
                NotificationService.Instance.Error(AppResources.ErrorWhenLoadingResourceMessage);
                return;
            }

            LekarskoUverenje = getLekarskoUverenjeResult.Data;

            _apiService.ChangeRoute(Routes.UputnicaRoute);
            var getUputnicaResult = await _apiService.Get <UputnicaDtoEL>(new UputnicaResourceParameters
            {
                EagerLoaded    = true,
                UputioDoktorId = LekarskoUverenje.Pregled.DoktorId,
                Datum          = LekarskoUverenje.Pregled.DatumPregleda
            });

            UputnicaId   = getUputnicaResult.Data?.FirstOrDefault()?.Id;
            UputnicaFlag = UputnicaId.HasValue;

            Id = LekarskoUverenje.Id;
            ZdravstvenoStanje = LekarskoUverenje.ZdravstvenoStanje.Opis;
            OpisStanja        = LekarskoUverenje.OpisStanja;
        }
        public async Task <PokemonAPI> Get(string url)
        {
            string json = await apiService.Get(url);

            PokemonAPI pokemonAPI = json.ToClassOf <PokemonAPI>();

            return(pokemonAPI);
        }
        public async Task FaceIDLogin()
        {
            //var photo = await Plugin.Media.CrossMedia.Current.TakePhotoAsync(
            //    new Plugin.Media.Abstractions.StoreCameraMediaOptions() { });

            var photo = await CrossMedia.Current.PickPhotoAsync();

            if (photo == null)
            {
                return;
            }

            IsBusy                = true;
            MainBodyVisible       = false;
            AnimationFrameVisible = true;

            SelfieForFaceID = photo.GetStream().AsByteArray();

            _apiService.ChangeRoute(Routes.PacijentiRoute);
            var result = await _apiService.Get <PacijentDtoEL>(new PacijentResourceParameters
            {
                EagerLoaded = true,
            });

            await Task.Delay(3500);

            if (!result.Succeeded || !result.HasData)
            {
                IsBusy                = false;
                MainBodyVisible       = true;
                AnimationFrameVisible = false;

                await Task.Delay(100);

                NotificationService.Instance.Error(AppResources.UnsuccessfullyAuthentication);
                return;
            }

            if (!await Auth.AuthenticateWithFaceID(SelfieForFaceID))
            {
                IsBusy                = false;
                MainBodyVisible       = true;
                AnimationFrameVisible = false;

                await Task.Delay(100);

                NotificationService.Instance.Error(AppResources.UnsuccessfullyAuthentication);
                return;
            }
            MainBodyVisible              = false;
            AnimationFrameVisible        = false;
            AnimationSuccessFrameVisible = true;
            await Task.Delay(2850);

            IsBusy = false;

            Application.Current.MainPage = new PacijentDasbhboardTabbedPage();
        }
        public async Task Init(int pregledId)
        {
            if (!Auth.IsAuthenticated())
            {
                NotificationService.Instance.Error(AppResources.UnauthenticatedAccessMessage);
                return;
            }

            _apiService.ChangeRoute(Routes.PreglediRoute);
            var getPregledResult =
                await _apiService.GetById <PregledDtoEL>(pregledId, eagerLoaded : true);

            if (!getPregledResult.Succeeded || !getPregledResult.HasData || getPregledResult.Data == null)
            {
                NotificationService.Instance.Error(AppResources.ErrorWhenLoadingResourceMessage);
                return;
            }
            Pregled = getPregledResult.Data;

            if (Pregled.IsOdradjen)
            {
                _apiService.ChangeRoute(Routes.LekarskoUverenjeRoute);
                var getLekarskoUverenjeResult = await _apiService.Get <LekarskoUverenjeDtoLL>(
                    new LekarskoUverenjeResourceParameters
                {
                    PregledId = pregledId
                });

                if (getLekarskoUverenjeResult.Succeeded && getLekarskoUverenjeResult.HasData)
                {
                    var lekarskoUverenje = getLekarskoUverenjeResult.Data.FirstOrDefault();
                    if (lekarskoUverenje != null)
                    {
                        LekarskoUverenjeId = lekarskoUverenje.Id;
                    }
                }
            }

            Id         = pregledId;
            Doktor     = Pregled.Doktor;
            DateTime   = Pregled.DatumPregleda;
            IsOdradjen = Pregled.IsOdradjen;
        }
        public async Task Init()
        {
            if (!Auth.IsAuthenticated())
            {
                NotificationService.Instance.Error(AppResources.UnauthenticatedAccessMessage);
                return;
            }
            _apiService = new APIService();

            _apiService.ChangeRoute(Routes.DoktoriRoute);
            var result = await _apiService.Get <DoktorDtoEL>(new DoktorResourceParameters { EagerLoaded = true });

            if (result.Succeeded)
            {
                Doktori = result.HasData ? result.Data : new List <DoktorDtoEL>();
            }
            else
            {
                NotificationService.Instance.Error(AppResources.UnableToLoadDataError);
            }
        }