public ActionResult DeleteConfirmed(int id) { carrera supp = db.carrera.Find(id); db.carrera.Remove(supp); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult DeleteConfirmed(string id) { carrera carrera = db.carreras.Find(id); db.carreras.Remove(carrera); db.SaveChanges(); return(RedirectToAction("Index")); }
void setData() { carrera Model = controladorCarrera.buscarCarrera(reference); Txt_nombre.Text = Model.nombre_carrera.ToString(); Txt_jornada.Text = Model.jornada_carrera.ToString(); Cbo_facultad.Text = Model.FACULTAD_id_facultad.ToString(); }
private void cleanForm() { FormUtils.clearTextbox(textControls()); rdbActivo.Checked = true; rdbInactivo.Checked = false; btnAgregar.Text = "Agregar"; selectedCarrera = null; errorProvider1.Clear(); }
public ActionResult Delete(int id) { carrera supp = db.carrera.Find(id); if (supp == null) { return(HttpNotFound()); } return(View(supp)); }
public ActionResult Edit(carrera supp) { if (ModelState.IsValid) { db.Entry(supp).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(supp)); }
public ActionResult Edit(int id) { carrera supp = db.carrera.Single(x => x.id == id); if (supp == null) { return(HttpNotFound()); } return(View(supp)); }
public ActionResult Create(carrera supp) { if (ModelState.IsValid) { db.carrera.Add(supp); db.SaveChanges(); return(RedirectToAction("Index")); } return(View()); }
public ActionResult Edit([Bind(Include = "idCarrera,nombreCarrera")] carrera carrera) { if (ModelState.IsValid) { db.Entry(carrera).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(carrera)); }
public ActionResult Edit([Bind(Include = "cod_carrera,nombre,tipo_carrera,modalidad,cod_dpto")] carrera carrera) { if (ModelState.IsValid) { db.Entry(carrera).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.cod_dpto = new SelectList(db.dptoes, "cod_dpto", "nombre", carrera.cod_dpto); return(View(carrera)); }
public ActionResult Edit([Bind(Include = "codigoCarrera,codigoArea,nombreCarrea")] carrera carrera) { if (ModelState.IsValid) { db.Entry(carrera).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.codigoArea = new SelectList(db.area, "codigoArea", "nombreArea", carrera.codigoArea); return(View(carrera)); }
public ActionResult Create([Bind(Include = "idCarrera,nombreCarrera")] carrera carrera) { if (ModelState.IsValid) { db.carreras.Add(carrera); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(carrera)); }
public ActionResult Create([Bind(Include = "cod_carrera,nombre,tipo_carrera,modalidad,cod_dpto")] carrera carrera) { if (ModelState.IsValid) { db.carreras.Add(carrera); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.cod_dpto = new SelectList(db.dptoes, "cod_dpto", "nombre", carrera.cod_dpto); return(View(carrera)); }
public ActionResult <carrera> Put([FromBody] carrera carrera, [FromHeader] string token) { if (UsuarioConexion <usuario> .Instance.getUserToken(token)) { CarreraConexion <carrera> .Instance.Update(carrera); return(Json("El proceso de almacenado se realizó con éxito.")); } else { return(null); } }
// GET: carreras/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } carrera carrera = db.carreras.Find(id); if (carrera == null) { return(HttpNotFound()); } return(PartialView(carrera)); }
private void fillSelectedData(carrera currentCarr) { txtNombre.Text = currentCarr.nombre; cmbFacultades.SelectedItem = currentCarr.facultad; cmbTipos.SelectedItem = currentCarr.tipo_carrera; if (currentCarr.estado) { rdbActivo.Checked = true; } else { rdbInactivo.Checked = true; } }
// GET: carreras/Delete/5 public ActionResult Delete(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } carrera carrera = db.carreras.Find(id); if (carrera == null) { return(HttpNotFound()); } return(View(carrera)); }
// GET: carreras/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } carrera carrera = db.carreras.Find(id); if (carrera == null) { return(HttpNotFound()); } ViewBag.cod_dpto = new SelectList(db.dptoes, "cod_dpto", "nombre", carrera.cod_dpto); return(PartialView(carrera)); }
// GET: carreras/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } carrera carrera = db.carrera.Find(id); if (carrera == null) { return(HttpNotFound()); } ViewBag.codigoArea = new SelectList(db.area, "codigoArea", "nombreArea", carrera.codigoArea); return(View(carrera)); }
//Metodo para guardar una nueva carrera public void guardarCarrera(String nombre_carrera, int FACULTAD_id_facultad, String jornada_carrera) { ModelAsignacion db = new ModelAsignacion(); carrera carreraNueva = new carrera(); carreraNueva.nombre_carrera = nombre_carrera; carreraNueva.FACULTAD_id_facultad = FACULTAD_id_facultad; carreraNueva.jornada_carrera = jornada_carrera; db.carrera.Add(carreraNueva); db.SaveChanges(); }
private void DgvCarreras_CellClick(object sender, DataGridViewCellEventArgs e) { try { int index = e.RowIndex; if (index >= 0) { selectedCarrera = carreras[index]; btnAgregar.Text = "Modificar"; fillSelectedData(selectedCarrera); } } catch (Exception ex) { FormUtils.defaultErrorMessage(ex); } }
public void InsertWithoutData(curso prod, carrera sup) { using (db) { //add instances to context db.curso.Add(prod); db.carrera.Add(sup); //add instance that relates to another entity // in this case prod is an instance of Product entity // Product has a property call Supplier prod.carrera.Add(sup); //call SaveChanges from context to confirm inserts db.SaveChanges(); } }
private void saveData() { carrera tempCarr = new carrera { nombre = txtNombre.Text, idFacultad = ((facultad)cmbFacultades.SelectedValue).id, idTipo = ((tipo_carrera)cmbTipos.SelectedValue).id, estado = rdbActivo.Checked }; Operation <carrera> operation = carreraController.addRecord(tempCarr); if (operation.State) { MessageBox.Show("Carrera agregada con éxito", "Éxito", MessageBoxButtons.OK, MessageBoxIcon.Information); loadTable(); cleanForm(); } }
public ActionResult Create(carrera insertcarrera) { HttpClient hc = new HttpClient(); hc.BaseAddress = new Uri("https://localhost:44316/api/CarreraCrud"); var insertrecord = hc.PostAsJsonAsync <carrera>("CarreraCrud", insertcarrera); insertrecord.Wait(); var guardardata = insertrecord.Result; if (guardardata.IsSuccessStatusCode) { return(RedirectToAction("ListadoCarreras")); } return(View("Create")); }
private void updateData(carrera currentCarr) { currentCarr.nombre = txtNombre.Text; currentCarr.idFacultad = ((facultad)cmbFacultades.SelectedValue).id; currentCarr.idTipo = ((tipo_carrera)cmbTipos.SelectedValue).id; currentCarr.estado = rdbActivo.Checked; Operation <carrera> operation = carreraController.updateRecord(currentCarr); if (operation.State) { MessageBox.Show("Carrera actualizada con éxito", "Éxito", MessageBoxButtons.OK, MessageBoxIcon.Information); loadTable(); cleanForm(); } else { MessageBox.Show(operation.Error, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void InsertWithData(int productID, int supplierID) { using (db) { /* * this steps have to follow to both entities * * 1 - create instance of entity with relative primary key * * 2 - add instance to context * * 3 - attach instance to context */ // 1 curso p = new curso { id = productID }; // 2 db.curso.Add(p); // 3 db.curso.Attach(p); // 1 carrera s = new carrera { id = supplierID }; // 2 db.carrera.Add(s); // 3 db.carrera.Attach(s); // like previous method add instance that relates to another entity p.carrera.Add(s); // call SaveChanges db.SaveChanges(); } }
public IHttpActionResult Insertcarrera(carrera insertcarrera) { uniwebsite.carreras.Add(insertcarrera); uniwebsite.SaveChanges(); return(Ok()); }