Example #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Vehicle_Registration vehicle_Registration = db.Vehicle_Registration.Find(id);

            db.Vehicle_Registration.Remove(vehicle_Registration);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #2
0
 public ActionResult Edit([Bind(Include = "Vehicle_ID,Manufacturer,Date_of_Registration,Registration_Number,Model,Remarks,Vehicle_Type")] Vehicle_Registration vehicle_Registration)
 {
     if (ModelState.IsValid)
     {
         db.Entry(vehicle_Registration).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(vehicle_Registration));
 }
Example #3
0
        public ActionResult Create([Bind(Include = "Vehicle_ID,Manufacturer,Date_of_Registration,Registration_Number,Model,Remarks,Vehicle_Type")] Vehicle_Registration vehicle_Registration)
        {
            if (ModelState.IsValid)
            {
                db.Vehicle_Registration.Add(vehicle_Registration);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(vehicle_Registration));
        }
Example #4
0
 // GET: Vehicle_Registration/Edit/5
 public ActionResult Edit(int?id)
 {
     if (Session["admin_id"] != null)
     {
         if (id == null)
         {
             return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
         }
         Vehicle_Registration vehicle_Registration = db.Vehicle_Registration.Find(id);
         if (vehicle_Registration == null)
         {
             return(HttpNotFound());
         }
         return(View(vehicle_Registration));
     }
     else
     {
         return(RedirectToAction("Indexlogout", "User"));
     }
 }
Example #5
0
        public ActionResult Index2(Vehicle_Registration v)
        {
            var data = db.Vehicle_Registration.Where(x => x.Registration_Number == v.Registration_Number).ToList();

            return(View(data));
        }