Exemple #1
0
 public ActionResult DeletePersona(int id)
 {
     if (ModelState.IsValid)
     {
         PersonaDb emprep = new PersonaDb(connectionString);
         if (emprep.DeletePersona(id))
         {
             ViewBag.Message = "Record Deleted Successfully";
         }
     }
     return(RedirectToAction("Index"));
 }
Exemple #2
0
 public ActionResult ModificaPersona(int id, Persona p)
 {
     if (ModelState.IsValid)
     {
         PersonaDb db = new PersonaDb(connectionString);
         if (db.ModificaPersona(id, p))
         {
             ViewBag.Message = "Operazione eseguita";
         }
     }
     return(RedirectToAction("Index"));
 }
Exemple #3
0
        public ActionResult AddPersona(Persona p)
        {
            if (ModelState.IsValid)
            {
                PersonaDb db = new PersonaDb(connectionString);
                if (db.AddPersona(p))
                {
                    ViewBag.Message = "Record aggiunto con successo";
                }
            }

            return(RedirectToAction("Index"));
        }
Exemple #4
0
        public ActionResult Modifica(int?id)
        {
            if (id == null || id == 0)
            {
                return(RedirectToAction("Index"));
            }

            PersonaDb db = new PersonaDb(connectionString);

            ModelState.Clear();
            Persona p = db.GetDetails(id.GetValueOrDefault());

            return(View(p));
        }
Exemple #5
0
        public IActionResult Index(Persona p)
        {
            if (p == null)
            {
                p = new Persona();
            }

            PersonaDb db = new PersonaDb(connectionString);

            ModelState.Clear();
            p.list = db.GetAll();

            return(View(p));
        }
Exemple #6
0
 //________________________________________________________________________________________________________
 public static List <PersonaDto> GetPersona()
 {
     return(PersonaDb.GetAll());
 }
Exemple #7
0
 //________________________________________________________________________________________________________
 public static void SavePersona(PersonaDto Persona)
 {
     PersonaDb.GrabarPersonas(ref Persona);
 }