コード例 #1
0
 public IActionResult NewFeedback([Bind("Id,Comments")] Feedbacks feedbacks)
 {
     if (ModelState.IsValid)
     {
         _context.Add(feedbacks);
         _context.SaveChanges();
         return(RedirectToAction(nameof(Feedbacks)));
     }
     return(View(feedbacks));
 }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("Id,Name,Comments")] Meal meal)
        {
            if (ModelState.IsValid)
            {
                _context.Add(meal);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(meal));
        }
コード例 #3
0
        public async Task <IActionResult> Create([Bind("Id,Name")] Chef chef)
        {
            if (ModelState.IsValid)
            {
                _context.Add(chef);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(chef));
        }
コード例 #4
0
        public async Task <IActionResult> Create([Bind("TableCategoryId,TableCapacity")] TableCategory tableCategory)
        {
            if (ModelState.IsValid)
            {
                _context.Add(tableCategory);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(tableCategory));
        }
コード例 #5
0
        public async Task <IActionResult> Create([Bind("TableId,TableCategoryId,IsBooked")] Table table)
        {
            if (ModelState.IsValid)
            {
                _context.Add(table);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["TableCategoryId"] = new SelectList(_context.TableCategories, "TableCategoryId", "TableCategoryId", table.TableCategoryId);
            return(View(table));
        }
コード例 #6
0
        public async Task <IActionResult> Create([Bind("CustomerId,CustomerName,Address,PhoneNumber,EmailAddress,GroupCount")] Customer customer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(customer);
                await _context.SaveChangesAsync();

                //return RedirectToAction(nameof(Index));
                return(RedirectToAction("IndexAvailable", "Tables"));
            }
            return(View(customer));
        }
コード例 #7
0
        public async Task <IActionResult> Create([Bind("BookingId,BookingDate,CustomerId,TableId")] Booking booking)
        {
            if (ModelState.IsValid)
            {
                _context.Add(booking);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CustomerId"] = new SelectList(_context.Customers, "CustomerId", "CustomerId", booking.CustomerId);
            ViewData["TableId"]    = new SelectList(_context.Tables, "TableId", "TableId", booking.TableId);
            return(View(booking));
        }
コード例 #8
0
 public IActionResult CreateMenu([FromBody] Menu menu)
 {
     _context.Add(menu);
     _context.SaveChanges();
     return(CreatedAtAction(nameof(Menu), new { id = menu.Id }, menu));
 }
コード例 #9
0
 public void Insert(MenuItem item)
 {
     context.Add(item);
     context.SaveChanges();
 }
コード例 #10
0
 public IActionResult CreateVoucher([FromBody] Vouchers voucher)
 {
     _context.Add(voucher);
     _context.SaveChanges();
     return(CreatedAtAction(nameof(Vouchers), new { id = voucher.Id }, voucher));
 }