VehicleAdd() public méthode

public VehicleAdd ( VehicleAdd newItem ) : VehicleWithDetail
newItem VehicleAdd
Résultat VehicleWithDetail
        public ActionResult Create(VehicleAdd newItem)
        {
            // Validate the input
            if (!ModelState.IsValid)
            {
                return(View(newItem));
            }

            // Process the input
            var addedItem = m.VehicleAdd(newItem);

            if (addedItem == null)
            {
                return(View(newItem));
            }
            else
            {
                return(RedirectToAction("details", new { id = addedItem.Id }));
            }
        }
Exemple #2
0
        public ActionResult AddVehicle(VehicleAdd newItem)
        {
            // Validate the input
            if (!ModelState.IsValid)
            {
                return(View(newItem));
            }

            // Process the input
            var addedItem = m.VehicleAdd(newItem);

            if (addedItem == null)
            {
                return(View(newItem));
            }
            else
            {
                // Attention - Must redirect to the Vehicles controller
                return(RedirectToAction("details", "vehicles", new { id = addedItem.Id }));
            }
        }