public async Task <IActionResult> Edit(int id, [Bind("PlanOfImplementId,ProductId,ImplePlan,Price")] PlanOfImplement planOfImplement) { if (id != planOfImplement.PlanOfImplementId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(planOfImplement); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PlanOfImplementExists(planOfImplement.PlanOfImplementId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ProductId"] = new SelectList(_context.Products, "ProductsId", "ProductsId", planOfImplement.ProductId); return(View(planOfImplement)); }
public async Task <IActionResult> Create([Bind("PlanOfImplementId,ProductId,ImplePlan,Price")] PlanOfImplement planOfImplement) { if (ModelState.IsValid) { _context.Add(planOfImplement); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ProductId"] = new SelectList(_context.Products, "ProductsId", "ProductsId", planOfImplement.ProductId); return(View(planOfImplement)); }