Exemple #1
0
        public ActionResult DeleteConfirmed(int?id)
        {
            Kilometros kilometros = db.Kilometros.Find(id);

            db.Kilometros.Remove(kilometros);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #2
0
        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));
        }
Exemple #3
0
        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));
        }
Exemple #4
0
        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));
        }
Exemple #5
0
        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));
        }