public ActionResult DeleteConfirmed(int id) { try { Accione accione = db.Acciones.Find(id); db.Acciones.Remove(accione); db.SaveChanges(); return(RedirectToAction("Index")); } catch (Exception ex) { return(View("ErrorDeleteRef", new HandleErrorInfo(ex, "Acciones", "Delete"))); } }
// GET: Acciones/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Accione accione = db.Acciones.Find(id); if (accione == null) { return(HttpNotFound()); } return(View(accione)); }
public ActionResult Edit([Bind(Include = "Id,nombre,descripcion,isSelected")] Accione accione) { if (ModelState.IsValid) { try { db.Entry(accione).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } catch (Exception ex) { return(View("ErrorCreateDup", new HandleErrorInfo(ex, "Acciones", "Edit"))); } } return(View(accione)); }
///////////////ACCIONES////////////////////////// //Agrega una accion en la base de datos public void registrarAccion(String accion) { Accione a = new Accione(); a.Fecha = DateTime.Today; a.Descripcion = accion; Database.Acciones.InsertOnSubmit(a); try { Database.SubmitChanges(); } catch (Exception) { MessageBox.Show("Error al registrar la accion"); } }