예제 #1
0
 public IActionResult Modificar(Contactos input)
 {
     if (ModelState.IsValid)
     {
         _db.Entry(input).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
         _db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(input));
 }
예제 #2
0
        public IActionResult Agregar(Contacto input)
        {
            if (ModelState.IsValid)
            {
                _db.Entry(input).State = Microsoft.EntityFrameworkCore.EntityState.Added;
                // _db.Contactos.Add (input); //
                _db.SaveChanges();

                return(RedirectToAction("Index"));
            }
            return(View(input));
        }