Ejemplo n.º 1
0
 public void Button_Click()
 {
     MPScript.Data.Match      = match;
     MPScript.Data.ReplayData = APIController.GetReplay(new Guid(match.ReplayId));
     GlobalRandom.Seed        = match.Seed;
     SceneManager.LoadScene(2);
 }
Ejemplo n.º 2
0
 public XtraMainForm()
 {
     InitializeComponent();
     APIController.InitClient();
     comboBoxSelectHostname.Properties.Items.Add("192.168.31.231");
     LoadSettings();
 }
Ejemplo n.º 3
0
    public void SEP()
    {
        int sep = APIController.GetSEP(activeSEP);

        SEPCountText.text = sep.ToString();
        Debug.Log("SEP: " + sep);
    }
Ejemplo n.º 4
0
        public void Teste_EditCaminhoneiro()
        {
            //Parametros
            var caminhoneiro     = db.Caminhoneiro.Where(c => c.idCaminhoneiro == 8).First();
            var caminhoneitoEdit = new Caminhoneiro();

            caminhoneitoEdit.idCaminhoneiro = caminhoneiro.idCaminhoneiro;
            caminhoneitoEdit.nome           = "Caminhoneiro Teste 8";
            caminhoneitoEdit.idade          = caminhoneiro.idade;
            caminhoneitoEdit.sexo           = caminhoneiro.sexo;
            caminhoneitoEdit.possuiVeiculo  = caminhoneiro.possuiVeiculo;
            caminhoneitoEdit.tipoCNH        = caminhoneiro.tipoCNH;
            caminhoneitoEdit.carregado      = caminhoneiro.carregado;
            caminhoneitoEdit.caminhao       = caminhoneiro.caminhao;
            caminhoneitoEdit.dataChegada    = caminhoneiro.dataChegada;
            caminhoneitoEdit.origem         = caminhoneiro.origem;
            caminhoneitoEdit.destino        = caminhoneiro.destino;

            var response = new HttpResponseMessage(HttpStatusCode.Created)
            {
                Content = new StringContent("Editado")
            };

            //Objeto API
            APIController apiController = new APIController();

            var teste = apiController.EditCaminhoneiro(caminhoneitoEdit);

            //Assert
            Assert.ReferenceEquals(response, teste);
        }
        public APIControllerUnitTest()
        {
            var options = new DbContextOptionsBuilder <GameContext>().UseSqlServer("Server=tcp:database-1.coqaybrmjcqc.us-east-2.rds.amazonaws.com,1433;Initial Catalog=test-database;Persist Security Info=False;User ID=admin;Password=admintestdatabase;MultipleActiveResultSets=False;Encrypt=True;Connection Timeout=30;TrustServerCertificate=True;").Options;

            _context    = new GameContext(options);
            _controller = new APIController(_context);
        }
Ejemplo n.º 6
0
        public void RedoPut()
        {
            string requestJsonData;

            using (var r = new StreamReader(resourceFolderPath + "\\TRRReport_csv.json"))
            {
                requestJsonData = r.ReadToEnd();
            }

            var merchantConfig = MerchantConfigObj("jwt", "PUT");

            merchantConfig.RequestTarget   = "/reporting/v2/reportSubscriptions/TRRReport?organizationId=testrest";
            merchantConfig.RequestJsonData = requestJsonData;

            var apiControllerObj = new APIController(merchantConfig);
            var responseObj      = apiControllerObj.PutPayment();

            if (responseObj.StatusCode == 400)
            {
                using (var r = new StreamReader(resourceFolderPath + "\\TRRReport_xml.json"))
                {
                    requestJsonData = r.ReadToEnd();
                }

                merchantConfig.RequestJsonData = requestJsonData;

                var apiControllerObjRetry = new APIController(merchantConfig);
                var responseObjRetry      = apiControllerObjRetry.PutPayment();
            }
        }
Ejemplo n.º 7
0
        public void Teste_PostCaminhoneiro()
        {
            //Parametros
            Caminhoneiro caminhoneiro = new Caminhoneiro();

            caminhoneiro.nome          = "Caminhoneiro Teste";
            caminhoneiro.idade         = 28;
            caminhoneiro.sexo          = "M";
            caminhoneiro.possuiVeiculo = "S";
            caminhoneiro.tipoCNH       = "D";
            caminhoneiro.carregado     = "S";
            caminhoneiro.caminhao      = 1;
            caminhoneiro.dataChegada   = DateTime.Now;

            var response = new HttpResponseMessage(HttpStatusCode.Created)
            {
                Content = new StringContent("Cadastrado")
            };

            //Objeto API
            APIController apiController = new APIController();

            var teste = apiController.PostCaminhoneiro(caminhoneiro);

            //Assert
            Assert.ReferenceEquals(response, teste);
        }
Ejemplo n.º 8
0
        private async void ReloadUserData()
        {
            var getUser_response = await APIController.GetUser();

            if (getUser_response.Item1 != APIController.Response.Success)
            {
                await DisplayAlert(title : "Error", message : "Error: " + getUser_response.Item2, cancel : "Ok");

                return;
            }
            else
            {
                var user = getUser_response.Item3;
                SaveUserData(user);

                UserData.Name    = user.Name;
                UserData.Surname = user.Surname;
                UserData.Email   = user.Email;

                Nick.Text  = UserData.Name + " " + UserData.Surname;
                Email.Text = UserData.Email;

                NameInput.Text    = UserData.Name;
                SurnameInput.Text = UserData.Surname;
                EmailInput.Text   = UserData.Email;
            }
        }
Ejemplo n.º 9
0
 /// <summary>
 /// Konstruktor klasy
 /// </summary>
 public LoginPage()
 {
     api                    = new APIController();
     BindingContext         = this;
     api.ErrorEventHandler += LoginFail;
     InitializeComponent();
 }
Ejemplo n.º 10
0
    public void InspectPlace()
    {
        var carScript = GameObject.FindWithTag("Carousel").GetComponent <Carrousel>();
        var index     = carScript.FowardIndex();

        carScript.Paused = true;

        var inspector = transform.parent.GetChild(6);

        inspector.gameObject.SetActive(true);
        var img = APIController.LoadTextureFromFile(index.ToString());

        if (!img)
        {
            img = _noImg;
        }

        inspector.GetChild(0).GetChild(0).GetComponent <Image>().sprite = Sprite.Create(img, new Rect(0.0f, 0.0f, img.width, img.height), new Vector2(0.5f, 0.5f), 100.0f);

        PlaceNearyby places = JsonConvert.DeserializeObject <PlaceNearyby>(APIController.ReadFromJson("NearbyPlaces"));

        inspector.GetChild(1).GetChild(0).GetComponent <Text>().text = places.Results[index].Name;
        inspector.GetChild(1).GetChild(1).GetComponent <Text>().text = places.Results[index].Vicinity;
        string location = "Lat: " + places.Results[index].Geometry.Location.Lat + "\nLng: " + places.Results[index].Geometry.Location.Lng;

        inspector.GetChild(1).GetChild(2).GetComponent <Text>().text = location;
    }
Ejemplo n.º 11
0
        private async void TryPatch()
        {
            if (!ValidateInput())
            {
                return;
            }

            //Send request to database
            var credentials = new UserPatchModel()
            {
                Email    = EmailInput.Text,
                Password = PasswordInput.Text,
                Name     = NameInput.Text,
                Surname  = SurnameInput.Text
            };

            Tuple <APIController.Response, string> response = await APIController.UserPatch(credentials);

            if (response.Item1 != APIController.Response.Success)
            {
                LabelErrorAlert.Text        = FeedbackMessages.RequestFail;
                LabelErrorAlert.IsVisible   = true;
                LabelSuccessAlert.IsVisible = false;
                Console.WriteLine("[REQUEST ERROR] " + response.Item2);
                return;
            }

            LabelErrorAlert.IsVisible   = false;
            LabelSuccessAlert.Text      = FeedbackMessages.SaveSuccess;
            LabelSuccessAlert.IsVisible = true;
        }
Ejemplo n.º 12
0
        public static void Run()
        {
            try
            {
                // Setting up Merchant Config
                var config = new Configuration();

                // Setting RequestJson Data using the sample payments data (instead of reading a JSON file)
                var requestData = new RequestData();

                var merchantConfig = new MerchantConfig(config.GetConfiguration())
                {
                    RequestTarget   = RequestTarget,
                    RequestType     = Enumerations.RequestType.POST.ToString(),
                    RequestJsonData = requestData.SamplePaymentsData()
                };

                // Call to the Controller of API_SDK
                var apiController = new APIController(merchantConfig);
                var response      = apiController.PostPayment();

                // printing the response details
                if (response != null)
                {
                    Console.WriteLine("\n v-c-correlation-id:{0}", response.GetResponseHeaderValue(response.Headers, "v-c-correlation-id"));
                    Console.WriteLine("\n Response Code:{0}", response.StatusCode);
                    Console.WriteLine("\n Response Message:{0}", response.Data);
                }
            }
            catch (Exception e)
            {
                ExceptionUtility.Exception(e.Message, e.StackTrace);
            }
        }
        public static void Run()
        {
            try
            {
                // Creating a dictionary object which contains the merchant configuration
                var config = new Configuration();

                // Passing the dictionary object to the Merchant Config Constructor to bypass the config set up via App.Config File
                var merchantConfig = new MerchantConfig(config.GetConfiguration())
                {
                    RequestTarget = RequestTarget,
                    RequestType   = Enumerations.RequestType.GET.ToString()
                };

                // Call to the Controller of API_SDK
                var apiController = new APIController(merchantConfig);
                var response      = apiController.GetPayment();

                // printing the response details
                if (response != null)
                {
                    Console.WriteLine("\n v-c-correlation-id:{0}", response.GetResponseHeaderValue(response.Headers, "v-c-correlation-id"));
                    Console.WriteLine("\n Response Code:{0}", response.StatusCode);
                    Console.WriteLine("\n Response Message:{0}", response.Data);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                Console.WriteLine(e.StackTrace);
            }
        }
Ejemplo n.º 14
0
        private void dUsers_BeginningEdit(object sender, DataGridBeginningEditEventArgs e)
        {
            UserInfo userInfo = (UserInfo)e.Row.Item;

            if (MessageBox.Show("Are you change the role of " + userInfo.Name + " from " + (userInfo.IsAdmin ? "admin to Regular user?" : "regular user to admin"), "Question", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.No)
            {
                e.Cancel = true; return;
            }
            userInfo.IsAdmin = !userInfo.IsAdmin;
            if (userInfo.IsAdmin)
            {
                userInfo.CanCreate = userInfo.CanUpdate = userInfo.CanRead = userInfo.CanDelete = true;
            }
            else
            {
                userInfo.CanRead = true; userInfo.CanCreate = userInfo.CanUpdate = userInfo.CanDelete = false;
            }
            ApiResult ret = APIController.RequestEditUserRole(userInfo);

            if (!ret.Success)
            {
                MessageBox.Show("Unable to edit user role"); e.Cancel = true; return;
            }
            LoadUsers(); e.Cancel = true;
        }
 void Start()
 {
     ProgramStateController.viewState();
     StartCoroutine(APIController.GetAssignmentQuesAPI());
     //StartCoroutine(GetQuesAPI());
     resultCanvas.gameObject.SetActive(false);
     UpdateBG(worldArr[UnityEngine.Random.Range(0, worldArr.Length)]);
     enemy.runtimeAnimatorController = Resources.Load <RuntimeAnimatorController>("Animations/assignmentMonster");
     if (character.Equals("Warrior"))
     {
         player.runtimeAnimatorController = Resources.Load <RuntimeAnimatorController>("Animation/RedWarrior");
     }
     else if (character.Equals("Magician"))
     {
         player.runtimeAnimatorController = Resources.Load <RuntimeAnimatorController>("Animation/Magician");
     }
     else if (character.Equals("Bowman"))
     {
         player.runtimeAnimatorController = Resources.Load <RuntimeAnimatorController>("Animation/Bowman");
     }
     else if (character.Equals("Swordman"))
     {
         player.runtimeAnimatorController = Resources.Load <RuntimeAnimatorController>("Animation/Swordman");
     }
 }
Ejemplo n.º 16
0
        public void Teste_CaminhoneiroPeriodo()
        {
            //Parametros
            string dataInicio = "01/05/2019";
            string dataFinal  = "10/05/2019";

            var listCaminhoneiros = db.Caminhoneiro.ToList();

            if (string.IsNullOrEmpty(dataFinal))
            {
                listCaminhoneiros = listCaminhoneiros.Where(c => c.dataChegada == Convert.ToDateTime(dataInicio) && c.carregado == "S").ToList();
            }
            else
            {
                listCaminhoneiros = listCaminhoneiros.Where(c => c.dataChegada >= Convert.ToDateTime(dataInicio) && c.carregado == "S").ToList();
                listCaminhoneiros = listCaminhoneiros.Where(c => c.dataChegada <= Convert.ToDateTime(dataFinal) && c.carregado == "S").ToList();
            }

            //Objeto API
            APIController apiController = new APIController();

            var teste = apiController.GetListCaminhoneiroPeriodo(dataFinal, dataFinal);

            //Assert
            Assert.ReferenceEquals(listCaminhoneiros, teste);
        }
        public JsonResult AddDocumentAttachmentThenSend()
        {
            HttpFileCollectionBase files = Request.Files;
            var           id             = int.Parse(Request.Form["ID"].ToString());
            var           form           = Request.Form;
            List <byte[]> fileBytes      = new List <byte[]>();

            foreach (string fileName in Request.Files)
            {
                if (fileName.Contains("otherFile"))
                {
                    HttpPostedFileBase file = Request.Files[fileName];
                    fileBytes.Add(ConverToBytes(file));
                }

                if (fileName.Contains("mainFile"))
                {
                    HttpPostedFileBase file = Request.Files[fileName];
                    var mainFile            = ConverToBytes(file);
                    docService.UpdateMainAttachment(id, mainFile);
                }
            }

            APIController api = new APIController();

            var resp = docService.UpdateDocumentAttachment(id, fileBytes);

            if (resp.Status)
            {
                api.RequestSendDocument(id);
            }
            resp.ResponseObject = id;
            return(Json(resp, JsonRequestBehavior.AllowGet));
        }
        private void load(TextureStore textures, APIController api, Storage store)
        {
            ProjectName.Text               = onlineProject.Name;
            ProjectDescription.Text        = onlineProject.Description;
            ImageContainer.Add(loadingIcon = new SpriteIcon
            {
                Size             = new Vector2(.7f),
                RelativeSizeAxes = Axes.Both,
                FillMode         = FillMode.Fit,
                Anchor           = Anchor.Centre,
                Origin           = Anchor.Centre,
                Icon             = FontAwesome.Solid.Spinner,
            });
            Schedule(async() =>  //ToDo: ????
            {
                var texture = await textures.GetAsync(@$ "https://gamestogo.company/api/Games/DownloadFile/{onlineProject.Image}");

                Schedule(() =>
                {
                    ProjectImage.Texture = texture;
                    loadingIcon.FadeOut();
                });
            });

            BottomContainer.Add(new SpriteText
            {
                Font = new FontUsage(size: SMALL_TEXT_SIZE),
                Text = @"Este juego ya fue publicado!",
            });

            var userRequest = new GetUserRequest(onlineProject.Creator.ID);

            userRequest.Success += user => UsernameBox.Text = @$ "De {user.Username} (Ultima vez editado {onlineProject.DateTimeLastEdited:dd/MM/yyyy HH:mm})";
            api.Queue(userRequest);
        }
        private async void OnRegisterClick(object sender, EventArgs e)
        {
            if (!ValidateInput())
            {
                return;
            }

            //Send request to database
            var credentials = new RegisterModel()
            {
                Email    = EmailInput.Text,
                Password = PasswordInput.Text,
                Name     = NameInput.Text,
                Surname  = SurnameInput.Text
            };

            Tuple <APIController.Response, string> response = await APIController.Register(credentials);

            if (response.Item1 != APIController.Response.Success)
            {
                await DisplayAlert(title : "Error", message : "Error: " + response.Item2, cancel : "Ok");

                return;
            }
            else
            {
                await DisplayAlert(title : "Success", message : "Account succesfully created! You can log in now", cancel : "Ok");

                //App.Current.MainPage = new LoginPage();
            }
        }
Ejemplo n.º 20
0
    public void FakeLogin()
    {
        // API
        APIController.SavePlayer(player.PlayerId, player.Name.Replace(" ", "%20"), player.AccessToken);

        // HeroicLabs
        Client.ApiKey = "31c210da7f0b4110bc301544870733d6";
        Client.Ping(onError);
        Client.LoginOAuthFacebook(player.AccessToken, (SessionClient session) =>
        {
            MPScript.Data.SessionClient = session;
            MPScript.Data.SessionClient.Gamer((Gamer gamer) =>
            {
                string nickname = player.Name.Replace(' ', '_');
                if (gamer.Nickname != nickname)
                {
                    MPScript.Data.SessionClient.UpdateGamer(nickname, onSuccess,
                                                            onError);
                }
            }, onError);
        }, onError);

        // Mixpanel
        Mixpanel.DistinctID = player.PlayerId;
        Mixpanel.SendEvent("DevSkip Login");
    }
Ejemplo n.º 21
0
        private async Task <bool> DownloadPlugin(InstalledPlugin plugin, EntityViewModel viewModel)
        {
            if (plugin.IsDownloaded)
            {
                return(true);
            }

            if (!plugin.IsSpigetPlugin || plugin.Plugin.file.type.Equals("external"))
            {
                return(false);
            }

            APIController apiController = new APIController();
            var           result        = await apiController.DownloadPluginAsync(plugin,
                                                                                  Path.Combine(App.ServerPath, viewModel.Entity.Name, "plugins",
                                                                                               StringUtils.PluginNameToJarName(plugin.Name) + ".jar"));

            /*HttpClient httpClient = new HttpClient(new HttpClientHandler{AllowAutoRedirect = true});
             * Uri uri = new Uri(new PluginWebRequester().BuildDownloadURL(plugin));
             * HttpResponseMessage response = await httpClient.GetAsync(uri);
             * await using (var fileStream = new FileStream(Path.Combine(App.ServerPath, viewModel.Entity.Name, "plugins", StringUtils.PluginNameToJarName(plugin.Name)+ ".jar"), FileMode.Create))
             * {
             *  await response.Content.CopyToAsync(fileStream);
             * }*/

            plugin.IsDownloaded = true;
            return(true);
        }
Ejemplo n.º 22
0
        private async Task <bool> DownloadPlugin(InstalledPlugin plugin, EntityViewModel viewModel)
        {
            if (plugin.IsDownloaded)
            {
                return(true);
            }

            if (!plugin.IsSpigetPlugin || plugin.Plugin.file.type.Equals("external"))
            {
                return(false);
            }

            APIController apiController = new APIController();

            try
            {
                var result = await apiController.DownloadPluginAsync(plugin,
                                                                     Path.Combine(App.ServerPath, viewModel.Entity.Name, "plugins",
                                                                                  StringUtils.PluginNameToJarName(plugin.Name) + ".jar"));

                if (result == null)
                {
                    return(false);
                }
            }
            catch (Exception e)
            {
                ErrorLogger.Append(e);
                return(false);
            }


            plugin.IsDownloaded = true;
            return(true);
        }
Ejemplo n.º 23
0
        public static void Run()
        {
            try
            {
                // Setting up Merchant Config
                var merchantConfig = new MerchantConfig
                {
                    RequestTarget = RequestTarget,
                    RequestType   = Enumerations.RequestType.GET.ToString()
                };

                // Call to the Controller of API_SDK
                var apiController = new APIController(merchantConfig);
                var response      = apiController.GetPayment();

                // printing the response details
                if (response != null)
                {
                    Console.WriteLine("\n v-c-correlation-id:{0}", response.GetResponseHeaderValue(response.Headers, "v-c-correlation-id"));
                    Console.WriteLine("\n Response Code:{0}", response.StatusCode);
                    Console.WriteLine("\n Response Message:{0}", response.Data);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                Console.WriteLine(e.StackTrace);
            }
        }
        public ActionResult Edit(EditAssignmentForm data)
        {
            string[] users       = data.users.Split(',');
            string[] assignments = data.assignments.Split(',');
            for (int x = 0; x < assignments.Length; x++)
            {
                APIController.EditAssignments(int.Parse(users[x]), int.Parse(assignments[x]), data.allocation_mode, data.allocation_amount, data.start_time, data.end_time);
            }

            if (data.phase_id == 0)
            {
                return(RedirectToRoute(new
                {
                    controller = "Project",
                    action = "Details",
                    projectID = data.project_id
                }));
            }
            else
            {
                return(RedirectToRoute(new
                {
                    controller = "Phase",
                    action = "Details",
                    projectID = data.project_id,
                    phaseID = data.phase_id
                }));
            }
        }
Ejemplo n.º 25
0
    public void register()
    {
        Debug.Log("Register Button Clicked!");
        getForm();

        StartCoroutine(APIController.RequestRegister(username, password, email, character, matriculationNo, confirmPassword));
    }
Ejemplo n.º 26
0
        private void TEST()
        {
            if (!File.Exists("gameDataAPI.json"))
            {
                File.WriteAllText("gameDataAPI.json", "[]");
            }

            var file = File.ReadAllText("gameDataAPI.json");

            var gameDataAPI = JsonConvert.DeserializeObject <List <Game> >(file);

            if (file == "[]")
            {
                APIController.GetGameCovers();
                SaveGameDataFromAPIToFile();
            }
            foreach (var game in Games)
            {
                // give back no game found?
                ReadGameDataFromFile();
                //this is the problem!!
                if (!gameDataAPI.Any(m => m.Name == game.Name))
                {
                    APIController.GetGameCovers();
                    SaveGameDataFromAPIToFile();
                }
            }
            if (file != "[]")
            {
                ReadGameDataFromFile();
            }
        }
Ejemplo n.º 27
0
        public void Random_Golden_Image_API(AbsaBase test)
        {
            APIController APIControllerInst = new APIController(BaseUrl);
            var           CurrentTest       = Reporting.CreateTest();
            var           response          = APIControllerInst.GetRequest("breed/retriever/golden/images/random", CurrentTest);

            response.ValidateResponseCode(HttpStatusCode.OK, CurrentTest);
        }
Ejemplo n.º 28
0
        public void Sub_Breed_API(AbsaBase test)
        {
            APIController APIControllerInst = new APIController(BaseUrl);
            var           CurrentTest       = Reporting.CreateTest();
            var           response          = APIControllerInst.GetRequest("breed/retriever/list", CurrentTest);

            response.ValidateResponseCode(HttpStatusCode.OK, CurrentTest);
        }
Ejemplo n.º 29
0
 private void CheckForkVersion()
 {
     LatestForkVersion = new APIController().GetLatestForkVersion();
     if (LatestForkVersion.CompareTo(CurrentForkVersion) > 0)
     {
         NewerVersionExists = true;
     }
 }
Ejemplo n.º 30
0
        public virtual async Task <HttpResponseMessage> Post([FromBody] Activity activity)
        {
            APIController.token = null;
            APIController.email = null;
            APIController.client.DefaultRequestHeaders.Authorization = null;
            APIController.client.DefaultRequestHeaders.Clear();
            APIController.client.DefaultRequestHeaders.Accept.Clear();
            APIController.client.DefaultRequestHeaders.Accept.Add(
                new MediaTypeWithQualityHeaderValue("application/json"));
            string jsonLocation = "";

            // check if activity is of type message
            if (activity != null && activity.GetActivityType() == ActivityTypes.Message)
            {
                for (int i = 0; i < activity.Entities.Count; ++i)
                {
                    if (activity.Entities[i].Type == "AuthorizationToken")
                    {
                        foreach (JProperty property in activity.Entities[i].Properties.Properties())
                        {
                            if (property.Name == "token")
                            {
                                //json += " token: "+ property.Value;
                                APIController.token += property.Value;
                                APIController.client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", APIController.token);
                            }
                        }
                    }
                    else if (activity.Entities[i].Type == "UserInfo")
                    {
                        foreach (JProperty property in activity.Entities[i].Properties.Properties())
                        {
                            if (property.Name == "current_location")
                            {
                                string temp = "";
                                temp    += property.Value;
                                location = JsonConvert.DeserializeObject <Location>(temp);
                            }
                        }
                    }
                }
                string jsonEmail = await APIController.Get("https://outlook.office.com/api/v2.0/me/EmailAddress").ConfigureAwait(false);

                User u = JsonConvert.DeserializeObject <User>(jsonEmail);
                APIController.client.DefaultRequestHeaders.Add("X-AnchorMailbox", u.Email);
                jsonLocation = await APIController.Get("https://atlas.microsoft.com/timezone/byCoordinates/JSON?subscription-key=V3ekeP_nmT_hKt80gNvIfnna_GOnkAwR_BhZhKZl03s&api-version=1.0&query=" + location.Hub.Latitude + "," + location.Hub.Longitude).ConfigureAwait(false);

                jsonLocation = cleanJson(jsonLocation);
                var timezone = JsonConvert.DeserializeObject <List <TimeZone> >(jsonLocation);
                timeZone     = timezone[0].Names.Standard;
                jsonLocation = await APIController.Get("https://atlas.microsoft.com/search/address/reverse/json?api-version=1.0&query=" + location.Hub.Latitude + "," + location.Hub.Longitude + "&subscription-key=JuXE_YnPpA-2G0TZx0tB2OcXQesyxznARhFZS5P6_g4");

                jsonLocation = cleanJson(jsonLocation);
                APIController.client.DefaultRequestHeaders.Add("Prefer", "outlook.timezone=\"" + timeZone + "\"");
                await Conversation.SendAsync(activity, () => new EchoDialog(jsonLocation));
            }
            return(new HttpResponseMessage(System.Net.HttpStatusCode.Accepted));
        }