public async Task <IActionResult> Create([Bind("Id,TypeName,Price,Color,Weight,Unit")] Product product) { if (ModelState.IsValid) { _context.Add(product); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(product)); }
public async Task <IActionResult> Create([Bind("Id,Fname,Lnam,City,Street,NumberHome")] 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,name,phone,email")] NewUser newUser) { if (ModelState.IsValid) { _context.Add(newUser); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(newUser)); }
public async Task <IActionResult> Create([Bind("Id,Color,Price,Type")] NewProduct newProduct) { if (ModelState.IsValid) { _context.Add(newProduct); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(newProduct)); }
public async Task <IActionResult> Create([Bind("Id,CustomerId")] Order order) { if (ModelState.IsValid) { _context.Add(order); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CustomerId"] = new SelectList(_context.Set <Customer>(), "Id", "Id", order.CustomerId); return(View(order)); }
public async Task <IActionResult> Create([Bind("id,OrderId,ProductId")] ProductOrder productOrder) { if (ModelState.IsValid) { _context.Add(productOrder); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["OrderId"] = new SelectList(_context.NewOrder, "Id", "Id", productOrder.OrderId); ViewData["ProductId"] = new SelectList(_context.NewProduct, "Id", "Id", productOrder.ProductId); return(View(productOrder)); }