Esempio n. 1
0
        public void Delete()
        {
            Person person = _db.Persons.First();

            _db.Remove(person);
            _db.SaveChanges();
        }
Esempio n. 2
0
        //Method responsible for deletion of the ticket
        public IActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Adhoc ticket = _contextAdhoc.Adhocs.SingleOrDefault(x => x.ID == id);

            if (ticket == null)
            {
                return(NotFound());
            }

            _contextAdhoc.Remove(ticket);
            _contextAdhoc.SaveChanges();

            TempData["message"] = "Ticket Deleted!";
            return(RedirectToAction("Index"));
        }
Esempio n. 3
0
        //Method responsible for deletion of the admin
        public IActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Admins admin = _contextAdmin.Admins.SingleOrDefault(x => x.ID == id);

            if (admin == null)
            {
                return(NotFound());
            }

            _contextAdmin.Remove(admin);
            _contextAdmin.SaveChanges();

            TempData["message"] = "Person Deleted!";
            return(RedirectToAction("Index"));
        }
        public IActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Person person = _context.People.SingleOrDefault(x => x.ID == id);

            if (person == null)
            {
                return(NotFound());
            }

            _context.Remove(person);
            _context.SaveChanges();

            TempData["message"] = "Person deleted!";

            return(RedirectToAction("Index"));
        }