Пример #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));
        }
        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));
        }
        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();
 }