示例#1
0
        public async Task <IActionResult> Create([Bind("CustomerId,FirstName,LastName,TelNumber,Address")] Customer customer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(customer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(customer));
        }
示例#2
0
        public async Task <IActionResult> Create([Bind("StaffId,FirstName,LastName,Phone")] Staff staff)
        {
            if (ModelState.IsValid)
            {
                _context.Add(staff);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(staff));
        }
        public async Task <IActionResult> Create([Bind("BookingId,BookingDate,CustomerId,staff_id")] Booking booking)
        {
            if (ModelState.IsValid)
            {
                _context.Add(booking);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CustomerId"] = new SelectList(_context.Customers, "CustomerId", "Address", booking.CustomerId);
            return(View(booking));
        }