public async Task <IActionResult> Create([Bind("BookID,Name,Author,Photo,YearOfPublishing")] Book book) { if (ModelState.IsValid) { _context.Add(book); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(book)); }
public async Task <IActionResult> Create([Bind("ClientID,Name,Age,LibraryID,BookID")] Client client) { if (ModelState.IsValid) { _context.Add(client); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["BookID"] = new SelectList(_context.Book, "BookID", "Name", client.BookID); return(View(client)); }