public async Task <IActionResult> PutOrders(int id, Orders orders) { if (id != orders.OrderId) { return(BadRequest()); } _context.Entry(orders).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!OrdersExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> Create([Bind("OrderId,ProductId,Quantity")] OrderItems orderItems) { if (ModelState.IsValid) { _context.Add(orderItems); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(orderItems)); }
public async Task <IActionResult> Create([Bind("CustomerId,Forename,Surname,Address")] Customers customers) { if (ModelState.IsValid) { _context.Add(customers); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(customers)); }
public async Task <IActionResult> Create([Bind("ProductId,ProductName,Category,Price,ReOrderLevel,StockLevel")] Products products) { if (ModelState.IsValid) { _context.Add(products); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(products)); }
public async Task <IActionResult> Create([Bind("OrderId,TableNumber,OrderTime")] Orders orders) { if (ModelState.IsValid) { _context.Add(orders); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(orders)); }
public async Task <IActionResult> Create([Bind("ProductId,ProductDetails,Price,Quantity")] Products products) { if (ModelState.IsValid) { _context.Add(products); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(products)); }
public async Task <IActionResult> Create([Bind("OrderId,OrderDate,CustomerId")] Orders orders) { if (ModelState.IsValid) { _context.Add(orders); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CustomerId"] = new SelectList(_context.Customers, "CustomerId", "Address", orders.CustomerId); return(View(orders)); }