コード例 #1
0
        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));
        }
コード例 #2
0
 public async Task <int> SaveAsync() => await _context.SaveChangesAsync();
コード例 #3
0
 private async Task <int> SaveAsync() => await _context.SaveChangesAsync();
コード例 #4
0
 public async Task <int> SaveAsync()
 {
     return(await _context.SaveChangesAsync());
 }