public async Task <IActionResult> Edit(string id, [Bind("title,author,ISBN,number,year")] Postbook postbook) { if (id != postbook.title) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(postbook); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PostbookExists(postbook.title)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(postbook)); }
public async Task <IActionResult> Create([Bind("title,author,ISBN,number,year")] Postbook postbook) { if (ModelState.IsValid) { _context.Add(postbook); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(postbook)); }