Esempio n. 1
0
        public async Task <IActionResult> Create([Bind("VehicleId,UserId,Make,Model,Year,Colour,Plate")] Vehicle vehicle)
        {
            ViewBag.UserId = HttpContext.Session.GetInt32("UserId");

            vehicle.UserId = ViewBag.UserId;

            if (ModelState.IsValid)
            {
                _vehicleLogic.CreateVehicle(vehicle);
                await _vehicleLogic.Save();

                return(RedirectToAction(nameof(ListVehicles)));
            }

            return(View(vehicle));
        }