public override async Task <SendFriendRequestResponse> SendFriendRequest(SendFriendRequestRequest request, ServerCallContext context) { RedisUserModel user = context.UserState["user"] as RedisUserModel; if (user == null) { return new SendFriendRequestResponse() { Status = ResponseFactory.createResponse(ResponseType.UNAUTHORIZED) } } ; RedisUserModel friend = await RedisUserModel.GetUserFromGuid(request.FriendId); if (friend == null) { return new SendFriendRequestResponse() { Status = ResponseFactory.createResponse(ResponseType.PLAYER_DOES_NOT_EXIST) } } ; if (await friend.HasFriendRequestFrom(user)) { return new SendFriendRequestResponse() { Status = ResponseFactory.createResponse(ResponseType.DUPLICATE) } } ; if (await friend.IsBlocked(user) || await user.IsBlocked(friend)) { return new SendFriendRequestResponse() { Status = ResponseFactory.createResponse(ResponseType.PLAYER_IS_BLOCKED) } } ; // Add request to the other player. await friend.AddFriendRequestFrom(user); return(new SendFriendRequestResponse() { Status = ResponseFactory.createResponse(ResponseType.SUCCESS) }); }