private void btnCrear_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtNombre.Text) || string.IsNullOrEmpty(txtDescripcion.Text)) { MessageBox.Show("Datos erroneos", "Departamento", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { DepartamentoLogica logica = new DepartamentoLogica(); Departamento nuevo = logica.CrearDepartamento(txtNombre.Text, txtDescripcion.Text); if (nuevo == null) { MessageBox.Show("Departamento ya existe", "Departamento", MessageBoxButtons.OK, MessageBoxIcon.Warning); txtNombre.Text = ""; txtDescripcion.Text = ""; } else { MessageBox.Show("Departamento " + nuevo.Nombre_departamento + " fue creado", "Departamento", MessageBoxButtons.OK, MessageBoxIcon.Information); //AdminMenu menu = new AdminMenu(usuario); //menu.Show(); listaDepartamentosTableAdapter1.Fill(conexionUsuarios1.ListaDepartamentos); txtNombre.Text = ""; txtDescripcion.Text = ""; } } }
public ActionResult DeleteConfirmed(int id) { DepartamentoLogica cl = new DepartamentoLogica(); cl.EliminarDepartamento(id); return(RedirectToAction("Index")); }
// GET: Departamentos public ActionResult Index() { var logica = new DepartamentoLogica(); var listado = logica.GetListadoDepartamentos(); return(View(listado)); }
public ActionResult Edit([Bind(Include = "Id,NombreDepartamento,PaisId")] DepartamentoModelo departamentoModelo) { if (ModelState.IsValid) { DepartamentoLogica cl = new DepartamentoLogica(); cl.EditarDepartamento(departamentoModelo); return(RedirectToAction("Index")); } return(View(departamentoModelo)); }
public ActionResult Delete(int id, DepartamentoModel dept) { try { var logica = new DepartamentoLogica(); logica.eliminarDept(id, dept); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Edit(int id, DepartamentoModel dept) { try { var logica = new DepartamentoLogica(); logica.editarPais(id, dept); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Create(DepartamentoModel dept) { try { var logica = new DepartamentoLogica(); logica.agregarDept(dept); return(RedirectToAction("Index")); } catch { return(View()); } }
// GET: Departamentos/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } DepartamentoModelo departamentoModelo = new DepartamentoLogica().EditarDepartamento(id); if (departamentoModelo == null) { return(HttpNotFound()); } return(View(departamentoModelo)); }
//Get: Pais/Departamentos/5 public ActionResult Departamentos(int id) { var logDept = new DepartamentoLogica(); return(View(logDept.getDepartamentoXPais(id))); }
// GET: Departamento/Delete/5 public ActionResult Delete(int id) { var logica = new DepartamentoLogica(); return(View(logica.obtenerDept(id))); }