Esempio n. 1
0
        public async Task <ActionResult> CancelFriendRequest([FromBody] FriendRequestDto dto)
        {
            var userId = _authService.GetLoggedinUserId();

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

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

            return(Ok());
        }