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)); }
public IHttpActionResult GetRUTAS(int id) { RUTAS rUTAS = db.RUTAS.Find(id); if (rUTAS == null) { return(NotFound()); } return(Ok(rUTAS)); }
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)); }
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)); }
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"); } }
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(); }
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"); } }