public async Task <IActionResult> Edit(int id, [Bind("Id,Attraction_Name,Attraction_Place,Attraction_Address,Attraction_Description,Attraction_Price,Attraction_Open_Hours")] Attraction attraction)
        {
            if (id != attraction.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(attraction);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AttractionExists(attraction.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(attraction));
        }
Beispiel #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,No_of_tickets,Ticket_price,CustomerId,HotelId,AttractionId,EventId")] Booking booking)
        {
            if (id != booking.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(booking);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BookingExists(booking.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AttractionId"] = new SelectList(_context.Attraction, "Id", "Attraction_Address", booking.AttractionId);
            ViewData["EventId"]      = new SelectList(_context.Event, "Id", "Event_Address", booking.EventId);
            ViewData["HotelId"]      = new SelectList(_context.Famous_Hotel, "Id", "Address", booking.HotelId);
            ViewData["CustomerId"]   = new SelectList(_context.Customer, "Id", "Address", booking.CustomerId);
            return(View(booking));
        }
Beispiel #3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Customer_Name,Mobile,Email,Address")] Customer customer)
        {
            if (id != customer.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(customer);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CustomerExists(customer.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(customer));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Hotal_Name,Address,Room_Price,Room_Type")] Hotel hotel)
        {
            if (id != hotel.Id)
            {
                return(NotFound());
            }

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