コード例 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("HotelId,PhoneNumber,Address,HotelName,Star,City,Country")] Hotel hotel)
        {
            if (id != hotel.HotelId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(hotel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!HotelExists(hotel.HotelId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(hotel));
        }
コード例 #2
0
        public async Task <IActionResult> Edit(int id, [Bind("BookId,ClientId,RoomId,CheckinDate,CheckoutDate")] Booking booking)
        {
            if (id != booking.BookId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(booking);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BookingExists(booking.BookId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ClientId"] = new SelectList(_context.Client, "ClientId", "ClientName", booking.ClientId);
            ViewData["RoomId"]   = new SelectList(_context.Room, "RoomId", "RoomId", booking.RoomId);
            return(View(booking));
        }
コード例 #3
0
        public async Task <IActionResult> Edit(int id, [Bind("ClientId,ClientName,ClientSurname,Password,Username")] Client client)
        {
            if (id != client.ClientId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(client);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ClientExists(client.ClientId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(client));
        }
コード例 #4
0
        public async Task <IActionResult> Edit(int id, [Bind("RoomId,HotelId,Capacity,Aircondition,Minibar,Television")] Room room)
        {
            if (id != room.RoomId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(room);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RoomExists(room.RoomId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["HotelId"] = new SelectList(_context.Hotel, "HotelId", "Address", room.HotelId);
            return(View(room));
        }
コード例 #5
0
        public async Task <IActionResult> Edit(int id, [Bind("StaffId,HotelId,StaffName,StaffSurname,Password,Username")] Staff staff)
        {
            if (id != staff.StaffId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(staff);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StaffExists(staff.StaffId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["HotelId"] = new SelectList(_context.Hotel, "HotelId", "Address", staff.HotelId);
            return(View(staff));
        }