コード例 #1
0
        public async Task <IActionResult> Create([Bind("CustomerID,Name,Company")] 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("ScheduleID,Time,Location,BookingID,CustomerID")] Schedule schedule)
        {
            if (ModelState.IsValid)
            {
                _context.Add(schedule);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["BookingID"] = new SelectList(_context.Booking, "BookingID", "BookingID", schedule.BookingID);
            return(View(schedule));
        }
コード例 #3
0
        public async Task <IActionResult> Create([Bind("BookingID,CustomerID,Schedule,NoContainer")] Booking booking)
        {
            if (ModelState.IsValid)
            {
                _context.Add(booking);
                await _context.SaveChangesAsync();

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