Beispiel #1
0
        public IActionResult ServiceInformation(ServiceAndVehicleViewModel v)
        { //receives view model containing new vehicle and uses this to update the vehicle with the same primary key in the database
            if (ModelState.IsValid)
            {
                vtx.UpdateVehicle(v.Vehicles);
                return(RedirectToAction(nameof(Index)));
            }



            return(RedirectToAction(nameof(Index)));
        }
Beispiel #2
0
        public IActionResult ServiceInformation(int id)
        { // assign the vehicle and its service records to model variable
            //then pass these to view
            var model = new ServiceAndVehicleViewModel();

            model.Services = vtx.GetAllServicesById(id);
            model.Vehicles = vtx.GetVehicleById(id);

            if (model.Vehicles == null)
            {
                return(NotFound());
            }

            return(View(model));
        }