示例#1
0
        public async Task <IActionResult> Create([Bind("ID,First_Name,Last_Name,Address,Gender,DOB")] Staff staff)
        {
            if (ModelState.IsValid)
            {
                _context.Add(staff);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(staff));
        }
示例#2
0
        public async Task <IActionResult> Create([Bind("ID,First_Name,Last_Name,Gender,Email_Id,DOB")] Customer customer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(customer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(customer));
        }
示例#3
0
        public async Task <IActionResult> Create([Bind("ID,Room_Name,Room_Type,Room_Number,Room_Stars")] Room room)
        {
            if (ModelState.IsValid)
            {
                _context.Add(room);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(room));
        }
示例#4
0
        public async Task <IActionResult> Create([Bind("ID,CustomerID,StaffID,RoomID")] Booking booking)
        {
            if (ModelState.IsValid)
            {
                _context.Add(booking);
                await _context.SaveChangesAsync();

                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));
        }