public async Task <IActionResult> Edit(string id, [Bind("IdGenero,Genero1")] Genero pGenero) { if (id != pGenero.IdGenero) { return(NotFound()); } if (ModelState.IsValid) { try { _recursoContext.Update(pGenero); await _recursoContext.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!GeneroExists(pGenero.IdGenero)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(pGenero)); }
public void ActualizaGenero() { using (var context = new db_RecursohumanoContext()){ var oGenero = new Genero(); oGenero.IdGenero = "H"; oGenero.Genero1 = "Prueba de actualizacion"; context.Update(oGenero); context.SaveChanges(); } }
public async Task <IActionResult> PutGenero(string id, Genero pGenero) { if (id != pGenero.IdGenero) { return(BadRequest()); } try{ _recursoContext.Update(pGenero); await _recursoContext.SaveChangesAsync(); }catch (DbUpdateConcurrencyException) { if (!GeneroExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }