public async Task <IActionResult> Edit(int id, [Bind("OrderId,ArticleId,Quantity,IsPlanned,Id")] T_CustomerOrderPart orderPart) { if (id != orderPart.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(entity: orderPart); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!OrderPartExists(id: orderPart.Id)) { return(NotFound()); } else { throw; } } ViewData[index : "OrderId"] = orderPart.CustomerOrderId; return(View(viewName: "../Orders/Index", model: await _context.GetAllOrders.ToListAsync())); } ViewData[index : "ArticleId"] = new SelectList(items : _context.GetSellableArticles, dataValueField : "Id", dataTextField : "Name", selectedValue : orderPart.ArticleId); ViewData[index : "OrderId"] = new SelectList(items : _context.CustomerOrders, dataValueField : "Id", dataTextField : "Name", selectedValue : orderPart.CustomerOrderId); return(PartialView(viewName: "Details", model: orderPart)); }
public async Task <IActionResult> Edit(int id, [Bind("OrderId,ArticleId,Quantity,IsPlanned,Id")] OrderPart orderPart) { if (id != orderPart.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(orderPart); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!OrderPartExists(orderPart.Id)) { return(NotFound()); } else { throw; } } ViewData["OrderId"] = orderPart.OrderId; return(View("../Orders/Index", await _context.GetAllOrders.ToListAsync())); } ViewData["ArticleId"] = new SelectList(_context.GetSellableArticles, "Id", "Name", orderPart.ArticleId); ViewData["OrderId"] = new SelectList(_context.Orders, "Id", "Name", orderPart.OrderId); return(PartialView("Details", orderPart)); }
public async Task <IActionResult> Edit(int id, [Bind("Name,DueTime,BusinessPartnerId,Id")] Order order) { if (id != order.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(order); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!OrderExists(order.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } ViewData["BusinessPartnerId"] = new SelectList(_context.BusinessPartners, "Id", "Name", order.BusinessPartnerId); return(PartialView("Details", order)); }
public async Task <IActionResult> Edit(int id, [Bind("Name,DueTime,BusinessPartnerId,Id")] T_CustomerOrder order) { if (id != order.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(entity: order); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!OrderExists(id: order.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(actionName: "Index")); } ViewData[index : "BusinessPartnerId"] = new SelectList(items : _context.BusinessPartners, dataValueField : "Id", dataTextField : "Name", selectedValue : order.BusinessPartnerId); return(PartialView(viewName: "Details", model: order)); }