Exemplo n.º 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Posicione posicione = db.Posiciones.Find(id);

            db.Posiciones.Remove(posicione);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 2
0
 public ActionResult Edit([Bind(Include = "Id,Nombre,Salario_Maximo,Salario_Minimo")] Posicione posicione)
 {
     if (ModelState.IsValid)
     {
         db.Entry(posicione).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(posicione));
 }
Exemplo n.º 3
0
        public ActionResult Create([Bind(Include = "Id,Nombre,Salario_Maximo,Salario_Minimo")] Posicione posicione)
        {
            if (ModelState.IsValid)
            {
                db.Posiciones.Add(posicione);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(posicione));
        }
Exemplo n.º 4
0
        // GET: Posiciones/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Posicione posicione = db.Posiciones.Find(id);

            if (posicione == null)
            {
                return(HttpNotFound());
            }
            return(View(posicione));
        }
Exemplo n.º 5
0
        private async void BtnModificarPosicion_Clicked(object sender, EventArgs e)
        {
            string connectionString = ConfigurationManager.AppSettings["ipServer"];

            try
            {
                var posicionIDV = posicionID;
                var posicionV   = Posicion.Text;

                if (string.IsNullOrEmpty(posicionV))
                {
                    await DisplayAlert("Validacion", "Asegurar que el nombre de la Posicion este ingresado", "Aceptar");

                    Posicion.Focus();
                    return;
                }

                HttpClient client = new HttpClient();
                client.BaseAddress = new Uri(connectionString);

                var posiciones = new Posicione()
                {
                    PosicionID = posicionIDV,
                    Posicion   = posicionV,
                };

                var           json          = JsonConvert.SerializeObject(posiciones);
                StringContent stringContent = new StringContent(json, Encoding.UTF8, "application/json");

                var request = await client.PostAsync("/api/Posicion/modificar", stringContent);

                if (request.IsSuccessStatusCode)
                {
                    var responseJson = await request.Content.ReadAsStringAsync();

                    var respuesta = JsonConvert.DeserializeObject <Request>(responseJson);

                    if (respuesta.status)
                    {
                        await MaterialDialog.Instance.AlertAsync(message : "La Posicion se modifico correctamente",
                                                                 title : "Registro",
                                                                 acknowledgementText : "Aceptar");
                    }
                    else
                    {
                        await MaterialDialog.Instance.AlertAsync(message : "La Posicion no pudo modificarse correctamente",
                                                                 title : "Registro",
                                                                 acknowledgementText : "Aceptar");
                    }
                }
                else
                {
                    await MaterialDialog.Instance.AlertAsync(message : "Error",
                                                             title : "Error",
                                                             acknowledgementText : "Aceptar");
                }
            }
            catch (Exception ex)
            {
                await MaterialDialog.Instance.AlertAsync(message : ex.Message,
                                                         title : ex.Message,
                                                         acknowledgementText : "Aceptar");
            }
            limpiarCampos();
            await Navigation.PushAsync(new Posiciones.GestionarPosiciones());
        }