public async Task <IActionResult> Edit(int id, [Bind("VehicleModelID,VehicleModelName,VehicleModelDescription,VehicleBrandID,VehicleModelYear,RecommendedRentalDailyPrice")] VehicleModel vehicleModel)
        {
            if (id != vehicleModel.VehicleModelID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(vehicleModel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!VehicleModelExists(vehicleModel.VehicleModelID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["VehicleBrandID"] = new SelectList(_context.VehicleBrands, "VehicleBrandID", "VehicleBrandID", vehicleModel.VehicleBrandID);
            return(View(vehicleModel));
        }
        public async Task <IActionResult> Edit(int id, [Bind("VehicleID,VehicleModelID,VehicleNotes,Color")] 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["VehicleModelID"] = new SelectList(_context.VehicleModels, "VehicleModelID", "VehicleModelID", vehicle.VehicleModelID);
            return(View(vehicle));
        }
        public async Task <IActionResult> Edit(int id, [Bind("VehicleRentalID,VehicleRentalRegistrationDate,VehicleRentalClientId,VehicleID,RentFromDate,RentToDate,DailyRentalPrice,Notes")] VehicleRental vehicleRental)
        {
            if (id != vehicleRental.VehicleRentalID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(vehicleRental);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!VehicleRentalExists(vehicleRental.VehicleRentalID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["VehicleID"]             = new SelectList(_context.Vehicles, "VehicleID", "VehicleID", vehicleRental.VehicleID);
            ViewData["VehicleRentalClientId"] = new SelectList(_context.VehicleRentalClients, "VehicleRentalClientId", "VehicleRentalClientId", vehicleRental.VehicleRentalClientId);
            return(View(vehicleRental));
        }
Пример #4
0
        public async Task <IActionResult> Edit(int id, [Bind("VehicleBrandID,VehicleBrandName,VehicleBrandDescription,VehicleBrandIntroductionDate")] VehicleBrand vehicleBrand)
        {
            if (id != vehicleBrand.VehicleBrandID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(vehicleBrand);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!VehicleBrandExists(vehicleBrand.VehicleBrandID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(vehicleBrand));
        }
Пример #5
0
        public async Task <IActionResult> Edit(int id, [Bind("VehicleRentalClientId,Name,PhoneNumber,LastName,Email,BirthDate,ID,Address")] VehicleRentalClient vehicleRentalClient)
        {
            if (id != vehicleRentalClient.VehicleRentalClientId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(vehicleRentalClient);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!VehicleRentalClientExists(vehicleRentalClient.VehicleRentalClientId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(vehicleRentalClient));
        }