コード例 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("VehicleControlStationID,Name,NIP,AddressID")] VehicleControlStation vehicleControlStation)
        {
            if (id != vehicleControlStation.VehicleControlStationID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(vehicleControlStation);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!VehicleControlStationExists(vehicleControlStation.VehicleControlStationID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(vehicleControlStation));
        }
コード例 #2
0
        public async Task <IActionResult> Edit(int id, [Bind("VehicleCardID,Number,Series,ExpirationData")] VehicleCard vehicleCard)
        {
            if (id != vehicleCard.VehicleCardID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(vehicleCard);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!VehicleCardExists(vehicleCard.VehicleCardID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(vehicleCard));
        }
コード例 #3
0
        public async Task <IActionResult> Edit(int id, [Bind("CarID,CarBrand,Category,Type,Model,Variant,Version")] Car car)
        {
            if (id != car.CarID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(car);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CarExists(car.CarID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(car));
        }
コード例 #4
0
        public async Task <IActionResult> Edit(int id, [Bind("VehicleID,Type,RegistrationNumber,TypeApprovalCertificate,ECTypeApproval,VIN,BodyNumber,ManufactureYear,InitialRegistration,WeatherDependent,RegistrationAuthority,DataOfTheBodyNumber,Destination,EngineSize,EnginePower,GrossVehicleWeightRating,AllowedPackage,AxleNumber,PermissibleAxleLoad,MaximumTowedMassOfTheTrailer,Allocation,FirstRegistrationAbroad,Subgenus,SuspensionType,AverageFuelConsumption,MaximumTotalWeight,DeadweightLoad,Equipment,RadarDevice,AutomobileMaker,Wheelbase,WheelbaseMIN,WheelbaseAVG,WheelbaseMAX,CarID,TechnicalResearchID,PESEL,VehicleCardID,RegistrationBookID")] Vehicle vehicle)
        {
            if (id != vehicle.VehicleID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(vehicle);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!VehicleExists(vehicle.VehicleID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CarID"] = new SelectList(_context.Cars, "CarID", "CarID", vehicle.CarID);
            ViewData["PESEL"] = new SelectList(_context.Owners, "PESEL", "PESEL", vehicle.PESEL);
            ViewData["RegistrationBookID"]  = new SelectList(_context.RegistrationBooks, "RegistrationBookID", "RegistrationBookID", vehicle.RegistrationBookID);
            ViewData["TechnicalResearchID"] = new SelectList(_context.TechnicalResearchs, "TechnicalResearchID", "TechnicalResearchID", vehicle.TechnicalResearchID);
            ViewData["VehicleCardID"]       = new SelectList(_context.VehicleCards, "VehicleCardID", "VehicleCardID", vehicle.VehicleCardID);
            return(View(vehicle));
        }