public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Description,SellerId")] Item item) { if (id != item.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(item); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ItemExists(item.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["SellerId"] = new SelectList(_context.Sellers, "Id", "FirstName", item.SellerId); return(View(item)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,FirstName,LastName,Email")] Buyer buyer) { if (id != buyer.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(buyer); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BuyerExists(buyer.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(buyer)); }