コード例 #1
0
        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));
        }
コード例 #2
0
 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();
     }
 }
コード例 #3
0
        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());
        }