コード例 #1
0
        public async Task <IActionResult> Create([Bind("OrderNumber,TotalSum,Date")] Order order)
        {
            if (ModelState.IsValid)
            {
                _context.Add(order);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(order));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("ID,TicketType,Price,isRound,DepartureTimeTo,ArrivalTimeTo,DepartureTimeFrom,ArrivalTimeFrom")] Ticket ticket)
        {
            if (ModelState.IsValid)
            {
                _context.Add(ticket);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(ticket));
        }
コード例 #3
0
        public async Task <IActionResult> Create([Bind("ID,FullName,Email")] Customer customer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(customer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(GetCustomers)));
            }
            return(View(customer));
        }
コード例 #4
0
 public void AddBooking(Booking newBooking)
 {
     context.Add <Booking>(newBooking);
     context.SaveChanges();
 }