Example #1
0
        public async Task <IActionResult> Accept(int senderId, int receiverId)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            var statuscode = await _friendRequestService.Accept(senderId, receiverId);

            return(_friendRequestResponseCreator.ResponseForAcceptOrDecline(statuscode));
        }
 public ActionResult Accept(int id)
 {
     try
     {
         _friendRequestService.Accept(id);
         return(RedirectToAction("GetUserFriends", "Home"));
     }
     catch (Exception ex)
     {
         return(Content(ex.Message));
     }
 }
Example #3
0
        public Reply Accept(FriendRequestData friendRequestData)
        {
            try
            {
                _sessionService.Validate(friendRequestData.UserId, friendRequestData.SessionToken);
            }
            catch (InvalidSessionException)
            {
                return(new Reply(HttpStatusCode.BadRequest, "Invalid session"));
            }

            _friendRequestService.Accept(friendRequestData.FriendRequestId);

            return(new Reply("Friend request has been accepted"));
        }