예제 #1
0
        public async Task <IActionResult> SuggestToTestDrive(int id, [Bind("Id,FirstName,LastName,Email,PhoneNumber,Date,StartTime,EndTime,Message")] TestDrive testDrive)
        {
            if (id != testDrive.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(testDrive);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TestDriveExists(testDrive.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(TestDriveList)));
            }
            return(View(testDrive));
        }
예제 #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Slide1,Slide2,Slide3")] HomeImage homeImage)
        {
            if (id != homeImage.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(homeImage);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!HomeImageExists(homeImage.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(homeImage));
        }
예제 #3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Make,Model,Year,Color,Engine,Price,Mileage,CarImage")] CarModel carModel)
        {
            if (id != carModel.Id)
            {
                return(NotFound());
            }

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