public async Task <IActionResult> Create([Bind("Id,From,To,BookId,ReaderId")] Borrow borrow) { if (ModelState.IsValid) { _context.Add(borrow); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["BookId"] = new SelectList(_context.Books, "Id", "Title", borrow.BookId); ViewData["ReaderId"] = new SelectList(_context.Readers, "Id", "LastName", borrow.ReaderId); return(View(borrow)); }
public async Task <int> SaveAsync() => await _context.SaveChangesAsync();
private async Task <int> SaveAsync() => await _context.SaveChangesAsync();
public async Task <int> SaveAsync() { return(await _context.SaveChangesAsync()); }