Esempio n. 1
0
        public HttpResponseMessage Eiminar([FromUri] int id)
        {
            try
            {
                var personas = PersonaDAO.Eliminar(id);
                if (personas == 1)
                {
                    return(Request.CreateResponse(HttpStatusCode.OK, personas));
                }

                else
                {
                    return(Request.CreateResponse(HttpStatusCode.NotFound,
                                                  new
                    {
                        Mensaje = $"No se encontro la persona con id {id}"
                    }));
                }
            }
            catch (Exception ex)
            {
                return(Request.CreateResponse(HttpStatusCode.InternalServerError,
                                              new
                {
                    Mensaje = ex.Message
                }));
            }
        }
Esempio n. 2
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            try
            {
                Persona persona = (Persona)lstPersonas.SelectedItem;

                PersonaDAO.Eliminar(persona);
                MessageBox.Show("Persona Eliminada exitosamente");
                this.Limpiar();
                this.Refrescar();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }