public async Task <IActionResult> Edit(int id, [Bind("Id,LibroId,FechaPrestamo,FechaEntrega")] Prestamo prestamo) { if (id != prestamo.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(prestamo); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PrestamoExists(prestamo.Id)) { return(NotFound()); } else { throw; } } prestamo.FechaEntrega = DateTime.Now; //return RedirectToAction(nameof(Index)); return(RedirectToAction("ReciboEntrada", prestamo)); } return(View(prestamo)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Nombre,Descripcion")] General general) { if (id != general.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(general); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!GeneralExists(general.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(general)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Titulo,Editorial,Year,DiasPrestamo")] Libro libro) { if (id != libro.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(libro); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LibroExists(libro.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(libro)); }