Esempio n. 1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,ParentChain,Rating,NumberOfRooms,Address,PhoneNumber,Email")] 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));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Price,Amenities,Capacity,View,Extendible,Damages")] Room room)
        {
            if (id != room.Id)
            {
                return(NotFound());
            }

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