示例#1
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,First_Name,Last_Name,Address,Gender,DOB")] Staff staff)
        {
            if (id != staff.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(staff);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StaffExists(staff.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(staff));
        }
示例#2
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,CustomerID,StaffID,RoomID")] 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["CustomerID"] = new SelectList(_context.Customer, "ID", "ID", booking.CustomerID);
            ViewData["RoomID"]     = new SelectList(_context.Room, "ID", "ID", booking.RoomID);
            ViewData["StaffID"]    = new SelectList(_context.Staff, "ID", "ID", booking.StaffID);
            return(View(booking));
        }
示例#3
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,First_Name,Last_Name,Gender,Email_Id,DOB")] 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));
        }
示例#4
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,Room_Name,Room_Type,Room_Number,Room_Stars")] 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));
        }