Exemplo n.º 1
0
        public IActionResult Block(UserBlockVM model, int blockUserId, int postId)
        {
            var user   = HttpContext.User;
            var UserId = int.Parse(user.Claims.ToList().First(x => x.Type == ClaimTypes.NameIdentifier).Value);

            if (ModelState.IsValid)
            {
                model.UserId        = UserId;
                model.BlockedUserId = blockUserId;
            }

            _blockedUserService.AddBlock(model);

            return(RedirectToAction(nameof(HomeController.Index), "Home", new { id = postId }));
        }