Example #1
0
        public IHttpActionResult PutRUTAS(int id, RUTAS rUTAS)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != rUTAS.RUTA_ID)
            {
                return(BadRequest());
            }

            db.Entry(rUTAS).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!RUTASExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Example #2
0
        public IHttpActionResult GetRUTAS(int id)
        {
            RUTAS rUTAS = db.RUTAS.Find(id);

            if (rUTAS == null)
            {
                return(NotFound());
            }

            return(Ok(rUTAS));
        }
Example #3
0
        public IHttpActionResult PostRUTAS(RUTAS rUTAS)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.RUTAS.Add(rUTAS);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = rUTAS.RUTA_ID }, rUTAS));
        }
Example #4
0
        public IHttpActionResult DeleteRUTAS(int id)
        {
            RUTAS rUTAS = db.RUTAS.Find(id);

            if (rUTAS == null)
            {
                return(NotFound());
            }

            db.RUTAS.Remove(rUTAS);
            db.SaveChanges();

            return(Ok(rUTAS));
        }
Example #5
0
        public void Delete(int id)
        {
            RUTAS rut = new RUTAS();

            rut = rutBll.GetById(new WInteger(id));

            if (rut != null)
            {
                rutBll.Delete(rut);
                CleanText(true);
                FillGrid();
                MessageBox.Show("ELIMINADO CORRECTAMENTE");
            }
            else
            {
                MessageBox.Show("REGISTRO NO ENCONTRADO");
            }
        }
Example #6
0
        public void Save()
        {
            RUTAS rut = new RUTAS();

            rut.CiudadOrigen  = Convert.ToInt32(cbxOrigen.SelectedValue);
            rut.CiudadDestino = Convert.ToInt32(cbxDestino.SelectedValue);
            rut.Valor         = Convert.ToDecimal(txtValor.Text);

            if (!string.IsNullOrEmpty(txtId.Text))
            {
                rut.IdRuta = Convert.ToInt32(txtId.Text);
            }

            rutBll.Save(rut, new WInteger(rut.IdRuta));
            MessageBox.Show("REGISTRADO CORRECTAMENTE");
            CleanText(true);
            FillGrid();
        }
Example #7
0
        public void Search(int id)
        {
            RUTAS rut = new RUTAS();

            rut = rutBll.GetById(new WInteger(id));

            if (rut != null)
            {
                txtId.Text = rut.IdRuta.ToString();
                cbxOrigen.SelectedValue  = rut.CiudadOrigen;
                cbxDestino.SelectedValue = rut.CiudadDestino;
                txtValor.Text            = rut.Valor.ToString();
            }
            else
            {
                MessageBox.Show("REGISTRO NO ENCONTRADO");
            }
        }