Exemple #1
0
        public T ProcessActionResult(string responseJson, Enum theAction)
        {
            JsonData blocksJson = JsonMapper.ToObject(responseJson);

            var user = new User(blocksJson);

            return(user.ItemCast(default(T)));
        }
        public T?ProcessActionResult(string responseJson, Enum theAction)
        {
            JsonElement blocksJson = JsonDocument.Parse(responseJson).RootElement;

            var user = new User(blocksJson);

            return(user.ItemCast(default(T)));
        }
Exemple #3
0
        public T ProcessActionResult(string responseJson, Enum theAction)
        {
            JsonData friendJson = JsonMapper.ToObject(responseJson);

            switch ((FriendshipAction)theAction)
            {
            case FriendshipAction.Create:
            case FriendshipAction.Destroy:
                var user = new User(friendJson);
                return(user.ItemCast(default(T)));

            case FriendshipAction.Update:
                var friendship = new Friendship(friendJson.GetValue <JsonData>("relationship"));
                return(friendship.ItemCast(default(T)));

            default:
                throw new InvalidOperationException("Unknown Action.");
            }
        }
Exemple #4
0
        public T?ProcessActionResult(string responseJson, Enum theAction)
        {
            JsonElement friendJson = JsonDocument.Parse(responseJson).RootElement;

            switch ((FriendshipAction)theAction)
            {
            case FriendshipAction.Create:
            case FriendshipAction.Destroy:
                var user = new User(friendJson);
                return(user.ItemCast(default(T)));

            case FriendshipAction.Update:
                var friendship = new Friendship(friendJson.GetProperty("relationship"));
                return(friendship.ItemCast(default(T)));

            default:
                throw new InvalidOperationException("Unknown Action.");
            }
        }