예제 #1
0
        public async Task <ActionResult> AcceptFriendRequest([FromBody] FriendRequestDto dto)
        {
            var userId = _authService.GetLoggedinUserId();

            if (dto.FromId != userId && dto.ToId != userId)
            {
                return(Unauthorized("Cannot accept friend request of someone else"));
            }

            var requestEntity = _mapper.Map <FriendRequest>(dto);
            await _friendService.AcceptFriendRequest(requestEntity);

            return(Ok());
        }
 public void AcceptFriendRequest(int friendId)
 {
     friendService.AcceptFriendRequest(Helper.GetUser(User.Identity.Name).Id, friendId);
 }