Esempio n. 1
0
        public async Task <IActionResult> Create([Bind("Id,VehicleModel,Registration,Owner,Apartment")] Vehicle vehicle)
        {
            if (ModelState.IsValid)
            {
                _context.Add(vehicle);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(vehicle));
        }
        public async Task <IActionResult> Create([Bind("PermitId,VehicleId,PermitStartDate,PermitEndDate,Valid,Fee,Premium")] Permit permit)
        {
            if (ModelState.IsValid)
            {
                _context.Add(permit);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["VehicleId"] = new SelectList(_context.Vehicle, "Id", "Id", permit.VehicleId);
            return(View(permit));
        }