Ejemplo n.º 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));
        }
Ejemplo n.º 2
0
 public async Task <int> SaveAsync() => await _context.SaveChangesAsync();
Ejemplo n.º 3
0
 private async Task <int> SaveAsync() => await _context.SaveChangesAsync();
 public async Task <int> SaveAsync()
 {
     return(await _context.SaveChangesAsync());
 }