public IHttpActionResult SendRequest([FromBody] ISofAUser isauser) { string Id = isauser.Id; bool salji = _friendRequestService.SendFriendRequest(Id, User.Identity.GetUserId()); if (salji) { return(Ok()); } else { return(BadRequest()); } }
public async Task PostSearchResult([FromBody] TypeaheadUsersVM person) { var loggedinUser = await _userService.GetloggedinUser(); var user = await _userService.GetUserByUserName(person.UserName); var friendRequestVM = new FriendRequestVM { FromUser = loggedinUser.Id, ToUser = person.Id, FromUserName = loggedinUser.UserName, ToUserName = person.UserName }; await _friendRequestService.SendFriendRequest(friendRequestVM); var friendRequests = await _friendRequestService.CheckFriendRequest(user); //var signalRModel = new FriendRequestVM[] { friendRequestVM }; await _friendRequestHubContext.Clients.User(friendRequestVM.ToUser) .ReceiveFriendRequest(true, friendRequests); }