public async Task <IActionResult> Edit(int id, [Bind("Id,Total,Details,DateCreated,DateModified,CustomerId")] 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(nameof(Index))); } ViewData["CustomerId"] = new SelectList(_context.Customer, "Id", "Lastname", order.CustomerId); return(View(order)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] Author author) { if (id != author.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(author); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AuthorExists(author.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(author)); }
public async Task <IActionResult> Edit(string id, [Bind("Isbn,Title,Language,Pages,AuthorId")] Book book) { if (id != book.Isbn) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(book); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BookExists(book.Isbn)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["AuthorId"] = new SelectList(_context.Author, "Id", "Name", book.AuthorId); return(View(book)); }