public async Task <IActionResult> Edit(int id, [Bind("Id,Codigo,DataRetirada,DataEntrega")] CadastroEmprestimoLivros cadastroEmprestimoLivros) { if (id != cadastroEmprestimoLivros.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(cadastroEmprestimoLivros); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CadastroEmprestimoLivrosExists(cadastroEmprestimoLivros.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(cadastroEmprestimoLivros)); }
public async Task <IActionResult> Create([Bind("Id,Codigo,DataRetirada,DataEntrega")] CadastroEmprestimoLivros cadastroEmprestimoLivros) { if (ModelState.IsValid) { _context.Add(cadastroEmprestimoLivros); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(cadastroEmprestimoLivros)); }