Example #1
0
        public async Task <DataManagerReponse <MinigameOverviewDto, MinigameOverviewSendDto> > SaveMinigameOverview(MinigameOverviewSendDto minigame)
        {
            var response = new DataManagerReponse <MinigameOverviewDto, MinigameOverviewSendDto>();

            LocalDataManager.Instance.SaveLocalData("MinigameOverview", minigame, Pacient.Loaded.Name);

            if (!ConfigurationManager.SendRemoteData || string.IsNullOrWhiteSpace(ConfigurationManager.GameApiToken))
            {
                return(response);
            }

            var hasInternetConnection = await ApiClient.Instance.HasInternetConnection();

            if (!hasInternetConnection)
            {
                LocalDataManager.Instance.SaveRemoteData("MinigameOverview", minigame, Pacient.Loaded.IdApi);
                response.LocalResponse = minigame;
                return(response);
            }
            response.ApiResponse = await ApiClient.Instance.SaveMinigameOverview(minigame);

            return(response);
        }
Example #2
0
        public async Task <DataManagerReponse <PacientDto, PacientSendDto> > UpdatePacient(PacientSendDto pacient)
        {
            var response = new DataManagerReponse <PacientDto, PacientSendDto>();

            LocalDataManager.Instance.SaveLocalData("Pacient", pacient, Pacient.Loaded.Name);

            if (!ConfigurationManager.SendRemoteData || string.IsNullOrWhiteSpace(ConfigurationManager.GameApiToken))
            {
                return(response);
            }

            var hasInternetConnection = await ApiClient.Instance.HasInternetConnection();

            if (!hasInternetConnection)
            {
                LocalDataManager.Instance.SaveRemoteData("Pacient", pacient, Pacient.Loaded.IdApi);
                response.LocalResponse = pacient;
                return(response);
            }

            response.ApiResponse = await ApiClient.Instance.UpdatePacient(pacient, Pacient.Loaded.IdApi);

            return(response);
        }