public async Task <IActionResult> Create([Bind("Id,CompanyName,ContactName,ContactTitle,City,Country,Phone,Fax")] Supplier supplier) { if (ModelState.IsValid) { _context.Add(supplier); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(supplier)); }
public async Task <IActionResult> Create([Bind("Id,FirstName,LastName,City,Country,Phone")] Customer customer) { if (ModelState.IsValid) { _context.Add(customer); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(customer)); }
public async Task <IActionResult> Create([Bind("Id,OrderDate,OrderNumber,CustomerId,TotalAmount")] Order order) { if (ModelState.IsValid) { _context.Add(order); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CustomerId"] = new SelectList(_context.Customer, "Id", "FirstName", order.CustomerId); return(View(order)); }
public async Task <IActionResult> Create([Bind("Id,ProductName,SupplierId,UnitPrice,Package,IsDiscontinued")] Product product) { if (ModelState.IsValid) { _context.Add(product); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["SupplierId"] = new SelectList(_context.Supplier, "Id", "CompanyName", product.SupplierId); return(View(product)); }
public async Task <IActionResult> Create([Bind("Id,OrderId,ProductId,UnitPrice,Quantity")] OrderItem orderItem) { if (ModelState.IsValid) { _context.Add(orderItem); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["OrderId"] = new SelectList(_context.Order, "Id", "Id", orderItem.OrderId); ViewData["ProductId"] = new SelectList(_context.Product, "Id", "ProductName", orderItem.ProductId); return(View(orderItem)); }