public ActionResult Edit(int id, PersonModel iList)
 {
     try
     {
         PersonDBHandler PersonHandler = new PersonDBHandler();
         PersonHandler.UpdateDetails(iList);
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
Exemple #2
0
        // GET: Person
        public ActionResult Index()
        {
            PersonModel model = new PersonModel();

            model.PageSize = 4;

            List <PersonDBHandler> people = PersonDBHandler.GetPersonList();

            if (people != null)
            {
                model.TotalCount = people.Count();
                model.People     = people;
            }

            return(View(model));
        }
 public ActionResult Delete(int id, PersonModel iList)
 {
     try
     {
         PersonDBHandler PersonHandler = new PersonDBHandler();
         if (PersonHandler.DeletePerson(id))
         {
             ModelState.Clear();
         }
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
 public ActionResult Create(PersonModel iList)
 {
     try
     {
         PersonDBHandler PersonHandler = new PersonDBHandler();
         if (PersonHandler.AddPerson(iList))
         {
             ModelState.Clear();
         }
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
 public ActionResult Delete(int id, IFormCollection collection)
 {
     try
     {
         PersonDBHandler PersonHandler = new PersonDBHandler(_configuration);
         if (PersonHandler.DeletePerson(id))
         {
             ModelState.Clear();
         }
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
        // GET: Person/Delete/5
        public ActionResult Delete(int id)
        {
            PersonDBHandler PersonHandler = new PersonDBHandler();

            return(View(PersonHandler.GetPersonDetails().Find(personmodel => personmodel.ID == id)));
        }
        // GET: Person
        public ActionResult Index()
        {
            PersonDBHandler PersonHandler = new PersonDBHandler();

            return(View(PersonHandler.GetPersonDetails()));
        }
        // GET: Person/Delete/5
        public ActionResult Delete(int id)
        {
            PersonDBHandler PersonHandler = new PersonDBHandler(_configuration);

            return(View(PersonHandler.GetPersonList().Find(personmodel => personmodel.ID == id)));
        }
        // GET: Person
        public ActionResult Index()
        {
            PersonDBHandler PersonHandler = new PersonDBHandler(_configuration);

            return(View(PersonHandler.GetPersonList()));
        }
        // GET: Person/Edit/5
        public ActionResult Edit(int id)
        {
            PersonDBHandler PersonHandler = new PersonDBHandler();

            return(View(PersonHandler.GetPersonList().Find(personmodel => personmodel.ID == id)));
        }