예제 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("TourID,TourName,TourTime,TourPrice,TicketsAvailable,TicketsSold,TourDuration,AdditionalInformation")] Tours tours)
        {
            if (id != tours.TourID)
            {
                return(NotFound());
            }

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