public IActionResult Create([Bind("Id,BookName,Category")] Book book)
 {
     if (ModelState.IsValid)
     {
         _context.Add(book);
         _context.SaveChanges();
         return(RedirectToAction(nameof(Index)));
     }
     return(View(book));
 }
Пример #2
0
 public IActionResult Create([Bind("Id,MemberName,ContactNumber")] Member member)
 {
     if (ModelState.IsValid)
     {
         _context.Add(member);
         _context.SaveChanges();
         return(RedirectToAction(nameof(Index)));
     }
     return(View(member));
 }
Пример #3
0
 public IActionResult Create([Bind("Id,MemberId,BookId,ReturnByDate")] LendingRecord lendingRecord)
 {
     if (ModelState.IsValid)
     {
         _context.Add(lendingRecord);
         _context.SaveChanges();
         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));
 }