Beispiel #1
0
        public IActionResult Delete(long id)
        {
            PersonDAO personDAO = new PersonDAO(_connection);
            var       toDel     = personDAO.FindById(id);

            if (toDel == null)
            {
                NotFound();
            }

            personDAO.Delete(toDel);

            return(NoContent());
        }
        public void Delete()
        {
            long id;

            Console.WriteLine("Insert id of person to be deleted:");
            String input = Console.ReadLine();

            try
            {
                id = Convert.ToInt64(input);
                dao.Delete(id);
            } catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Beispiel #3
0
        public ActionResult Delete(string password)
        {
            var returnedPerson = PersonDAO.Search(UserSession.ReturnPersonId(null));
            if (returnedPerson == null) return RedirectToAction("Logout", "User");
            var returnedUser = UserDAO.Search(returnedPerson.UserId);

            if (password != returnedUser.Password)
            {
                ModelState.AddModelError("", "Error - Password does not match");
                return View("Account");
            }

            PersonDAO.Delete(returnedPerson);
            UserDAO.Delete(returnedUser);
            
            return RedirectToAction("Logout", "User");
        }