Exemplo n.º 1
0
        public async Task <confirmStatus> SendConfirmAsync(userValidation Id)
        {
            var uri1 = Constants.RestUrl1.ToString();

            try
            {
                var json    = JsonConvert.SerializeObject(Id);
                var content = new StringContent(json, Encoding.UTF8, "application/json");

                HttpResponseMessage response = new HttpResponseMessage();

                response = await client.PutAsync(uri1, content);

                if (response.IsSuccessStatusCode)
                {
                    confirmStatus stat = new confirmStatus();
                    stat.statusCode = true;
                    return(stat);
                }

                else
                {
                    confirmStatus statfail = new confirmStatus();
                    statfail.statusCode = false;
                    return(statfail);
                }
            }
            catch (Exception ex)
            {
                confirmStatus exfail = new confirmStatus();
                exfail.statusCode = false;
                return(exfail);
            }
        }
Exemplo n.º 2
0
        //private async void OnDeleteActivated(object sender, EventArgs e)
        //{
        //    confirmEntry.Text = "This button pressed";
        //    valInfo input = new valInfo();
        //    input.valString = "3800745c-f10c-4d11-a6df-3296df27ee0e";
        //     List<Building> content = await App.BuildManager.GetTasksAsync(input);
        //    //List<Building> testList = await App.BuildManager.GetTasksAsync(input);

        //    buildingList = JsonConvert.DeserializeObject<List<Building>>(content.ToString());
        //}

        private async void confirmButton_Clicked(object sender, EventArgs e)
        {
            userValidation confVal = new userValidation();

            confVal.Token      = confirmEntry.Text;
            confVal.cookieInfo = null;
            confirmEntry.Text  = "Confirmation Code Sent";
            confirmStatus confirmCheck = new confirmStatus();

            confirmCheck = await App.BuildManager.SendConfirmAsync(confVal);

            bool sometest = confirmCheck.statusCode;

            //           confirmEntry.Text = confirmCheck.statusCode.ToString();
            if (sometest)
            {
                var buildPage = new MainPage();
                await Navigation.PushAsync(buildPage);
            }
            else
            {
                confirmEntry.Text = "Confirmation Code Not Accepted";
            }
        }