public ActionResult DeleteUser(int id) { List <Message> Sendedmsg = msgdb.GetByExp(x => x.SenderId == id); List <Message> Receivedmsg = msgdb.GetByExp(x => x.ReceivederId == id); List <ArtComment> ArtComments = artcmddb.GetByExp(x => x.Comment.UserID == id); List <Comment> Comments = cmddb.GetByExp(x => x.UserID == id); List <Article> Articles = artdb.GetByExp(x => x.UserID == id); List <Like> Likes = likedb.GetByExp(x => x.AppUserId == id); likedb.DeleteAll(Likes); artcmddb.DeleteAll(ArtComments); msgdb.DeleteAll(Sendedmsg); msgdb.DeleteAll(Receivedmsg); cmddb.DeleteAll(Comments); artdb.DeleteAll(Articles); db.DeleteById(id); db.Save(); return(RedirectToAction("Users", "Admin", new { area = "Admin" })); }