public IActionResult DELETE(int MsgId, int UserId) { ViewBag.Id = HttpContext.Session.GetInt32("UId"); Message msg = dbContext.Messages .Include(a => a.Comments) .ThenInclude(b => b.Creator) .FirstOrDefault(c => c.MsgId == MsgId); System.Console.WriteLine(MsgId); System.Console.WriteLine(UserId); dbContext.Remove(msg); dbContext.SaveChanges(); return(RedirectToAction("Community")); }