예제 #1
0
        public ActionResult DeleteUser(int id)
        {
            var user = _context.User.Where(m => m.Id == id).Single();

            _context.Remove(user);
            _context.SaveChanges();
            return(RedirectToAction(nameof(ListUsers)));
        }
예제 #2
0
        public ActionResult HardDeleteMessage(int id)
        {
            var message = _context.Messages.Where(m => m.Id == id).Single();

            _context.Remove(message);
            _context.SaveChanges();
            return(RedirectToAction(nameof(ListMessages)));
        }