public ActionResult DeleteConfirmed(int id) { RegistroSpare registroSpare = db.spare.Find(id); db.spare.Remove(registroSpare); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "SpareID,Nombre,NumeroParte,SerialNumero,Almacen,Fecha")] RegistroSpare registroSpare) { if (ModelState.IsValid) { db.Entry(registroSpare).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(registroSpare)); }
public ActionResult Create(RegistroSpare registroSpare) { if (ModelState.IsValid) { SpareBLL.Guardar(registroSpare); return(RedirectToAction("Index")); } return(View(registroSpare)); }
public ActionResult Create([Bind(Include = "SpareID,Nombre,NumeroParte,SerialNumero,Almacen,Fecha")] RegistroSpare registroSpare) { if (ModelState.IsValid) { db.Spare.Add(registroSpare); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(registroSpare)); }
// GET: RegistroSpares/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } RegistroSpare registroSpare = db.spare.Find(id); if (registroSpare == null) { return(HttpNotFound()); } return(View(registroSpare)); }
public static bool Guardar(RegistroSpare spare) { bool retorno = false; try { var db = new InventarioDB(); // if (db.usuario.Find(usuario) != null) // db.Entry(usuario).State = EntityState.Modified; // else db.spare.Add(spare); db.SaveChanges(); retorno = true; } catch (Exception) { throw; } return(retorno); }