public IActionResult Edit(int id, [Bind("Id,MemberId,BookId,ReturnByDate")] LendingRecord lendingRecord) { if (id != lendingRecord.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(lendingRecord); _context.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!LendingRecordExists(lendingRecord.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["BookId"] = new SelectList(_context.Book, "Id", "Id", lendingRecord.BookId); ViewData["MemberId"] = new SelectList(_context.Member, "Id", "Id", lendingRecord.MemberId); return(View(lendingRecord)); }
public IActionResult Edit(int id, [Bind("Id,BookName,Category")] Book book) { if (id != book.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(book); _context.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!BookExists(book.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(book)); }
public IActionResult Edit(int id, [Bind("Id,MemberName,ContactNumber")] Member member) { if (id != member.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(member); _context.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!MemberExists(member.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(member)); }