public ActionResult DeleteConfirmed(int id)
        {
            Motorizare motorizare = db.Motorizares.Find(id);

            db.Motorizares.Remove(motorizare);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "MotorizareID,Nume,ProducatorID")] Motorizare motorizare)
 {
     if (ModelState.IsValid)
     {
         db.Entry(motorizare).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(motorizare));
 }
        public ActionResult Create([Bind(Include = "MotorizareID,Nume,ProducatorID")] Motorizare motorizare)
        {
            if (ModelState.IsValid)
            {
                db.Motorizares.Add(motorizare);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(motorizare));
        }
        // GET: /Motorizare/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Motorizare motorizare = db.Motorizares.Find(id);

            if (motorizare == null)
            {
                return(HttpNotFound());
            }
            return(View(motorizare));
        }
Exemplo n.º 5
0
        public ActionResult GetMartori(int p, int m, int mot)
        {
            Producator producator = db.Producators.Where(_p => _p.ProducatorID == p).First();
            Model      model      = db.Models.Where(_m => _m.ModelID == m).First();
            Motorizare motorizare = db.Motorizares.Where(_mot => _mot.MotorizareID == mot).First();

            ViewBag.Model      = model.Nume;
            ViewBag.Producator = producator.Nume;
            ViewBag.Motorizare = motorizare.Nume;
            ViewBag.An         = motorizare.An;

            ViewBag.m   = model.ModelID;
            ViewBag.p   = producator.ProducatorID;
            ViewBag.mot = motorizare.MotorizareID;


            var martori = db.MartoriBords.ToList();

            return(View(martori));
        }