public async Task <IActionResult> Create([Bind("CategoryID,CategoryName,Description")] Category category) { if (ModelState.IsValid) { _context.Add(category); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(category)); }
public async Task <IActionResult> Create([Bind("EmployeeID,LastName,FirstName,Title,TitleOfCourtesy,BirthDate,HireDate,Address,City,Region,PostalCode,Country,HomePhone,Extension,Notes")] Employee employee) { if (ModelState.IsValid) { _context.Add(employee); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(employee)); }
public async Task <IActionResult> Create([Bind("ShipperID,ShipperName,Phone")] Shipper shipper) { if (ModelState.IsValid) { _context.Add(shipper); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(shipper)); }
public async Task <IActionResult> Create([Bind("SupplierID,CompanyName,ContactName,ContactTitle,Address,City,Region,PostalCode,Country,Phone,Fax,HomePage")] Supplier supplier) { if (ModelState.IsValid) { _context.Add(supplier); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(supplier)); }
public async Task <IActionResult> Create([Bind("OrderID,ProductID,UnitPrice,Quantity,Discount")] OrderDetail orderDetail) { if (ModelState.IsValid) { _context.Add(orderDetail); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["OrderID"] = new SelectList(_context.Orders, "OrderId", "OrderId", orderDetail.OrderID); ViewData["ProductID"] = new SelectList(_context.Products, "ProductId", "ProductName", orderDetail.ProductID); return(View(orderDetail)); }
public async Task <IActionResult> Create([Bind("ProductId,ProductName,SupplierID,CategoryID,QuantityPerUnit,UnitPrice,UnitsInStock,UnitsOnOrder,ReorderLevel,Discontinued")] Product product) { if (ModelState.IsValid) { _context.Add(product); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CategoryID"] = new SelectList(_context.Categories, "CategoryID", "CategoryName", product.CategoryID); ViewData["SupplierID"] = new SelectList(_context.Suppliers, "SupplierID", "CompanyName", product.SupplierID); return(View(product)); }
public async Task <IActionResult> Create([Bind("OrderId,CustomerID,EmployeeID,OrderDate,RequiredDate,ShippedDate,ShipVia,Freight")] Order order) { if (ModelState.IsValid) { _context.Add(order); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CustomerID"] = new SelectList(_context.Customers, "CustomerID", "CustomerID", order.CustomerID); ViewData["EmployeeID"] = new SelectList(_context.Employees, "EmployeeID", "FirstName", order.EmployeeID); ViewData["ShipVia"] = new SelectList(_context.Shippers, "ShipperID", "ShipperID", order.ShipVia); return(View(order)); }