public async Task <IActionResult> PutGenero(int id, Genero genero) { if (id != genero.idGenero) { return(BadRequest()); } _context.Entry(genero).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!GeneroExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> Create([Bind("Id,Titulo")] Libro libro) { if (ModelState.IsValid) { _context.Add(libro); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(libro)); }