public async Task <IActionResult> Edit(int id, [Bind("BookID,Name,AuthorName,PublicationDate,PublisherID,GenreID,Description")] Book book) { if (id != book.BookID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(book); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BookExists(book.BookID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["GenreID"] = new SelectList(_context.GENRES, "GenreID", "Name", book.GenreID); ViewData["PublisherID"] = new SelectList(_context.PUBLISHERS, "PublisherID", "Name", book.PublisherID); return(View(book)); }
public async Task <IActionResult> Edit(int id, [Bind("BookCopiesID,BookBarcode,BookID,RetailerID,PurchasePrice,RFID,UpdatedDateTime")] BookCopies bookCopies) { if (id != bookCopies.BookCopiesID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(bookCopies); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BookCopiesExists(bookCopies.BookCopiesID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["BookID"] = new SelectList(_context.Set <Book>(), "BookID", "Name", bookCopies.BookID); ViewData["RetailerID"] = new SelectList(_context.Set <Retailer>(), "RetailerID", "Name", bookCopies.RetailerID); return(View(bookCopies)); }
public async Task <IActionResult> Edit(int id, [Bind("PublisherID,Name,Address1,Address2,Suburb,City,Postcode,PhoneNumber,WebsiteURL")] Publisher publisher) { if (id != publisher.PublisherID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(publisher); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PublisherExists(publisher.PublisherID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(publisher)); }
public async Task <IActionResult> Edit(int id, [Bind("GenreID,Name,Description,MinimumAge")] Genre genre) { if (id != genre.GenreID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(genre); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!GenreExists(genre.GenreID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(genre)); }
public async Task <IActionResult> Edit(int id, [Bind("RetailerID,Name,Address1,Address2,City,PhoneNumber,WebsiteURL,EmailAddress")] Retailer retailer) { if (id != retailer.RetailerID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(retailer); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RetailerExists(retailer.RetailerID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(retailer)); }