public ActionResult DeleteConfirmed(int?id) { Kilometros kilometros = db.Kilometros.Find(id); db.Kilometros.Remove(kilometros); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id_Kilometros,Id_Viatura,QuantidadeKm,DataRegisto")] Kilometros kilometros) { if (ModelState.IsValid) { db.Entry(kilometros).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Id_Viatura = new SelectList(db.Viatura, "Id_Viatura", "Matricula", kilometros.Id_Viatura); return(View(kilometros)); }
public ActionResult Create([Bind(Include = "Id_Viatura,QuantidadeKm,DataRegisto")] Kilometros kilometros) { if (ModelState.IsValid) { db.Kilometros.Add(kilometros); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Id_Viatura = new SelectList(db.Viatura, "Id_Viatura", "Matricula", kilometros.Id_Viatura); return(View(kilometros)); }
public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Kilometros kilometros = db.Kilometros.Find(id); if (kilometros == null) { return(HttpNotFound()); } return(View(kilometros)); }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Kilometros kilometros = db.Kilometros.Find(id); if (kilometros == null) { return(HttpNotFound()); } ViewBag.Id_Viatura = new SelectList(db.Viatura, "Id_Viatura", "Matricula", kilometros.Id_Viatura); return(View(kilometros)); }