public async Task <IActionResult> Create([Bind("Id,Name,Price")] 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,KindPerson,Identify,Name,BithDate")] Client client) { if (ModelState.IsValid) { _context.Add(client); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(client)); }
public async Task <IActionResult> Create([Bind("Id,DateClientOrder,ClientId")] ClientOrder clientOrder) { if (ModelState.IsValid) { _context.Add(clientOrder); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ClientId"] = new SelectList(_context.Client, "Id", "Id", clientOrder.ClientId); return(View(clientOrder)); }
public async Task <IActionResult> Create([Bind("Id,Quantity,ProductId,ClientOrderId")] ProductOrder productOrder) { if (ModelState.IsValid) { _context.Add(productOrder); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ClientOrderId"] = new SelectList(_context.ClientOrder, "Id", "Id", productOrder.ClientOrderId); ViewData["ProductId"] = new SelectList(_context.Set <Product>(), "Id", "Id", productOrder.ProductId); return(View(productOrder)); }