예제 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Pojazdy pojazdy = db.Pojazdy.Find(id);

            db.Pojazdy.Remove(pojazdy);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public ActionResult Create([Bind(Include = "Id_pojazdu,Marka,Model,Rok_produkcji,Numer_rejestracyjny")] Pojazdy pojazdy)
        {
            if (ModelState.IsValid)
            {
                db.Pojazdy.Add(pojazdy);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(pojazdy));
        }
예제 #3
0
 public ActionResult Edit([Bind(Include = "ID,NrRejestracyjny,MasaCalkowita,Stawka,Kierowca,NrKomorkowyKierowcy,IDPrzewoznika,IDNaczepy")] Pojazdy pojazdy)
 {
     if (ModelState.IsValid)
     {
         db.Entry(pojazdy).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.IDNaczepy     = new SelectList(db.Naczepy, "ID", "NrRejestracyjny", pojazdy.IDNaczepy);
     ViewBag.IDPrzewoznika = new SelectList(db.Przewoznicy, "ID", "Nazwa", pojazdy.IDPrzewoznika);
     return(View(pojazdy));
 }
예제 #4
0
        // GET: Pojazdy/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Pojazdy pojazdy = db.Pojazdy.Find(id);

            if (pojazdy == null)
            {
                return(HttpNotFound());
            }
            return(View(pojazdy));
        }
예제 #5
0
        // GET: Pojazdy/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Pojazdy pojazdy = db.Pojazdy.Find(id);

            if (pojazdy == null)
            {
                return(HttpNotFound());
            }
            ViewBag.IDNaczepy     = new SelectList(db.Naczepy, "ID", "NrRejestracyjny", pojazdy.IDNaczepy);
            ViewBag.IDPrzewoznika = new SelectList(db.Przewoznicy, "ID", "Nazwa", pojazdy.IDPrzewoznika);
            return(View(pojazdy));
        }