public void Guardar() { if (ceditor.ID < 0) { Camione cm = new Camione { NOMBRE = ceditor.Nombre, DESCRIPCION = ceditor.Descripcion }; data.Camiones.InsertOnSubmit(cm); } else { var query = from c in data.Camiones where c.CODIGO == ceditor.ID select c; Camione m = query.First<Camione>(); m.NOMBRE = ceditor.Nombre; m.DESCRIPCION = ceditor.Descripcion; } data.SubmitChanges(); toDGV(); }
public ActionResult DeleteConfirmed(string id) { Camione camione = db.Camiones.Find(id); db.Camiones.Remove(camione); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "SerialNumber,Placa,Modelo,Year,IsActive")] Camione camione) { if (ModelState.IsValid) { db.Entry(camione).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(camione)); }
public ActionResult Create([Bind(Include = "SerialNumber,Placa,Modelo,Year,IsActive")] Camione camione) { if (ModelState.IsValid) { db.Camiones.Add(camione); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(camione)); }
// GET: Camiones/Delete/5 public ActionResult Delete(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Camione camione = db.Camiones.Find(id); if (camione == null) { return(HttpNotFound()); } return(View(camione)); }
public override int add() { try { Camione dataCamion = new Camione { CODIGO = truck.Codigo, NOMBRE = truck.Nombre, DESCRIPCION = truck.Descripcion }; Data.Camiones.InsertOnSubmit(dataCamion); Data.SubmitChanges(); return 1; } catch (Exception exc) { Utils.logExceptionError(exc); return 0; } }