示例#1
0
 private void frmEstados_Load(object sender, EventArgs e)
 {
     try
     {
         servicio = new ServicioEstado();
         lista    = servicio.GetLista();
         MostrarDatosEnGrilla();
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
        public bool Delete(int Id)
        {
            ServicioEstado servicioEstado;

            try
            {
                servicioEstado = new ServicioEstado();
                return(servicioEstado.EliminarFisico(Id));
            }
            catch (Exception excepcion)
            {
                throw excepcion;
            }
        }
        public bool Crear([FromBody] Estado estado)
        {
            ServicioEstado servicioEstado;

            try
            {
                servicioEstado = new ServicioEstado();
                return(servicioEstado.AgregarNuevo(estado));
            }
            catch (Exception excepcion)
            {
                throw excepcion;
            }
        }
        public List <Estado> Listar()
        {
            ServicioEstado servicioEstado;

            try
            {
                servicioEstado = new ServicioEstado();
                return(servicioEstado.Listar());
            }
            catch (Exception excepcion)
            {
                throw excepcion;
            }
        }
        public bool Put(int Id, [FromBody] Estado estado)
        {
            ServicioEstado servicioEstado;

            try
            {
                estado.Id      = Id;
                servicioEstado = new ServicioEstado();
                return(servicioEstado.GuardarModificado(estado));
            }
            catch (Exception excepcion)
            {
                throw excepcion;
            }
        }