Example #1
0
        public async Task <IActionResult> UnblockUser(int id, int recipientId)
        {
            if (id != int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value))
            {
                return(Unauthorized());
            }

            var block = await _repo.GetBlock(id, recipientId);

            if (block == null)
            {
                return(BadRequest("You have not blocked this user"));
            }

            if (await _repo.GetUser(recipientId) == null)
            {
                return(NotFound());
            }

            await _repo.DelBlock(id, recipientId);

            return(Ok());
        }