public async Task <IActionResult> Create([Bind("CarID,CarBrand,Category,Type,Model,Variant,Version")] Car car) { if (ModelState.IsValid) { _context.Add(car); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(car)); }
public async Task <IActionResult> Create([Bind("VehicleCardID,Number,Series,ExpirationData")] VehicleCard vehicleCard) { if (ModelState.IsValid) { _context.Add(vehicleCard); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(vehicleCard)); }
public async Task <IActionResult> Create(VehicleControlStation vehicleControlStation) { if (_context.VehicleControlStations.Where(s => s.Name.Equals(vehicleControlStation.Name)).FirstOrDefault() != null) { return(RedirectToAction(nameof(Index))); } vehicleControlStation.Entrepreneur.Address = vehicleControlStation.Address; _context.Add(vehicleControlStation); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); }
public async Task <IActionResult> Create([Bind("VehicleControlStationID,Name,NIP,AddressID")] VehicleControlStation vehicleControlStation) { if (ModelState.IsValid) { _context.Add(vehicleControlStation); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["AddressID"] = new SelectList(_context.Addresses, "AddressID", "AddressID", vehicleControlStation.AddressID); ViewData["NIP"] = new SelectList(_context.Entrepreneurs, "NIP", "NIP", vehicleControlStation.NIP); return(View(vehicleControlStation)); }
public async Task <IActionResult> Create([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 (ModelState.IsValid) { _context.Add(vehicle); await _context.SaveChangesAsync(); 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)); }