Пример #1
0
        public async Task <IActionResult> AcceptFriendRequest(FriendRequestDto friendRequestDto)
        {
            if (friendRequestDto.ReceiverId != int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value))
            {
                return(Unauthorized());
            }

            return(Ok(await _friendsService.AcceptFriendRequest(friendRequestDto)));
        }
Пример #2
0
        public async Task <IActionResult> AcceptFriendRequest(UserFriendBL request)
        {
            try
            {
                var res = await _service.AcceptFriendRequest(request);

                return(Ok(res));
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "FriendsAPIController.AcceptFriendRequest");
                return(new StatusCodeResult(500));
            }
        }
        public ActionResult AddFriend(AddFriendDto addFriend)
        {
            try
            {
                _friendsService.AcceptFriendRequest(addFriend);
            }
            catch (FlowException ex)
            {
                return(BadRequest(ex.Message));
            }
            catch (Exception)
            {
                return(StatusCode(500, "An error has occured!Try again later!"));
            }

            return(Ok());
        }