public ActionResult Create(Vehicle vehicle)
        {
            if (ModelState.IsValid)
            {
                db.Vehicles.Add(vehicle);
                db.SaveChanges();
                //return RedirectToAction("Index");
                ViewBag.VehicleEntryMessage = vehicle.Make + " " + vehicle.Model + " entered successfully!";
                if (_configLogLevel > 2)
                {
                    _logsController.LogMessage(3, "Successful entry for: " + vehicle.Make + " " + vehicle.Model + " by " + User.Identity.Name);
                }
                ModelState.Clear();
                return View();
            }

            return View(vehicle);
        }
        public ActionResult VehicleQuery(Vehicle queryVehicle)
        {
            if (Session != null)
            {
                Session["LastVehicleQuery"] = queryVehicle.Make + " " + queryVehicle.Model;
            }

            var vehicles = from v in db.Vehicles
                          where v.Make.ToUpper().Contains(queryVehicle.Make.ToUpper()) && v.Model.ToUpper().Contains(queryVehicle.Model.ToUpper())
                          select v;

            if (vehicles.Count() > 0)
            {
                if (_configLogLevel > 2)
                {
                    _logsController.LogMessage(3, "Successful query for: " + queryVehicle.Make + " " + queryVehicle.Model);
                }
                return View(vehicles);
            }
            else
            {
                if (_configLogLevel > 1)
                {
                    _logsController.LogMessage(2, "No record found for: " + queryVehicle.Make + " " + queryVehicle.Model);
                }
                throw new NoRecordFoundException();
            }
        }
 public ActionResult Edit(Vehicle vehicle)
 {
     if (ModelState.IsValid)
     {
         db.Entry(vehicle).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(vehicle);
 }