Exemple #1
0
        private async void InitializeAsync()
        {
            pickerCiudades.ItemsSource = await RestConsumer.GetNombresCiudades();

            pickerCiudades.SelectedItem = sede.nombre_ciudad;
            botonModificar.Clicked     += BotonModificar_Clicked;
        }
Exemple #2
0
        private async void OnDelete(object sender, EventArgs e)
        {
            Sede toDelete = (Sede)((MenuItem)sender).CommandParameter;
            await RestConsumer.DeleteSede(toDelete);

            //AQUI PUEDE ESPERARSE UNA RESPUESTA POSITIVA Y REACCIONAR CON UN DISPLAYALERT
            SedesList.ItemsSource = await RestConsumer.GetSedes();
        }
Exemple #3
0
        private async void BotonModificar_Clicked(object sender, EventArgs e)
        {
            if (pickerCiudades.SelectedItem != null)
            {
                await RestConsumer.UpdateSede(sede, pickerCiudades.SelectedIndex + 1);

                Navigation.PopAsync();
            }
        }
Exemple #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            id = Request.QueryString["Id"];

            if (!IsPostBack)
            {
                var acao = "Novo";

                var nome  = string.Empty;
                var login = string.Empty;
                var email = string.Empty;
                var senha = string.Empty;
                var ativo = false;


                RestConsumer <PerfilViewModel> perfilConsumer = new RestConsumer <PerfilViewModel>();

                var perfis       = new List <PerfilViewModel>();
                var outrosPerfis = perfilConsumer.GetAll();

                if (!string.IsNullOrWhiteSpace(id))
                {
                    int id = int.Parse(Request.QueryString["Id"]);

                    var usuario = Index.consumer.GetById(id);
                    if (usuario != null)
                    {
                        acao = "Editar";

                        nome  = usuario.Nome;
                        email = usuario.Email;
                        login = usuario.Login;
                        senha = usuario.Senha;
                        ativo = usuario.Ativo;

                        perfis       = usuario.Perfis?.Select(up => up.Perfil).ToList();
                        outrosPerfis = outrosPerfis.Where(p => !perfis.Contains(p)).ToList();
                    }
                }

                LblAcao.Text = acao;

                TxtLogin.Text    = login;
                TxtNome.Text     = nome;
                TxtEmail.Text    = email;
                TxtSenha.Text    = senha;
                ChkAtivo.Checked = ativo;

                ListPerfis.DataSource = perfis;
                ListOutros.DataSource = outrosPerfis;

                ListPerfis.DataBind();
                ListOutros.DataBind();
            }
        }
Exemple #5
0
        public void SetUp()
        {
            var fakeTask = new Task <string>(() => FakeSerializedObjecString);

            this.fakeUri = A.Fake <IUri>();

            A.CallTo(() => fakeUri.ToUri()).Returns(new Uri(BaseUrl));

            this.fakeFactory = A.Fake <IWrapperFactory>();

            this.fakeHttpClient = A.Fake <IHttpClient>();
            A.CallTo(() => this.fakeHttpClient.GetStringAsync(A <IUri> .Ignored)).Returns(fakeTask);
            this.fakeHttpClient.GetStringAsync(fakeUri).Start();

            this.testee = new RestConsumer(fakeUri, this.fakeHttpClient, fakeFactory);
        }
Exemple #6
0
        public override ActionResult CreateOrEdit(int?id)
        {
            UsuarioViewModel obj = null;

            if (id != null && id > 0)
            {
                obj = consumer.GetById(id.Value);
            }
            else
            {
                obj = new UsuarioViewModel();
            }

            RestConsumer <PerfilViewModel> perfilConsumer = new RestConsumer <PerfilViewModel>();
            var perfis = perfilConsumer.GetAll();

            if (obj.Perfis != null)
            {
                perfis = perfis.Where(p => !obj.Perfis.Select(oP => oP.Perfil).Contains(p)).ToList();
            }

            ViewBag.OutrosPerfis = perfis;
            return(View(obj));
        }
        public void SetUp()
        {
            var fakeTask = new Task<string>(() => FakeSerializedObjecString);

            this.fakeUri = A.Fake<IUri>();

            A.CallTo(() => fakeUri.ToUri()).Returns(new Uri(BaseUrl));

            this.fakeFactory = A.Fake<IWrapperFactory>();

            this.fakeHttpClient = A.Fake<IHttpClient>();
            A.CallTo(() => this.fakeHttpClient.GetStringAsync(A<IUri>.Ignored)).Returns(fakeTask);
            this.fakeHttpClient.GetStringAsync(fakeUri).Start();

            this.testee = new RestConsumer(fakeUri, this.fakeHttpClient, fakeFactory);
        }
Exemple #8
0
 private async void InitializeAsync()
 {
     SedesList.ItemsSource = await RestConsumer.GetSedes();
 }
Exemple #9
0
 public ApiConsumer(string baseUrl)
 {
     _restConsumer = new RestConsumer(baseUrl);
 }
Exemple #10
0
        private async void InitializeAsync()
        {
            pickerCiudades.ItemsSource = await RestConsumer.GetNombresCiudades();

            pickerTipoJuego.ItemsSource = await RestConsumer.GetDescripcionesTipoJJOO();
        }
Exemple #11
0
        private async void BotonNuevo_Clicked(object sender, EventArgs e)
        {
            await RestConsumer.CreateSede(int.Parse(anyoInput.Text), pickerTipoJuego.SelectedIndex + 1, pickerCiudades.SelectedIndex + 1);

            Navigation.PopAsync();
        }
        internal BaseRepository(string baseUrl, HttpBasicAuthenticator authenticator)
        {
            Rest = new RestConsumer(baseUrl, authenticator);
            FormatExtension = ".json";

        }
Exemple #13
0
 private async void InitializeAsync()
 {
     OlimpiadasList.ItemsSource = await RestConsumer.GetCiudadesCompleto();
 }