Exemplo n.º 1
0
        static void Main(string[] args)
        {
            //var timespan = TimeSpan.FromDays(1);

            //var x = TimeSpan.Parse(timespan.ToString());
            //Console.WriteLine(x);

            using (var client = new HypermediaSampleClient("http://hypermediasamplewebapi.azurewebsites.net/", ""))
            {
                var post = client.GetPostByIdAsync(38).Result;
            }
        }
Exemplo n.º 2
0
        // TODO:
        // - SerializeAsEmbedded relationships
        // - BackingField field could look at the parent object if it is not set (ie, default or null)
        // - BackingField should not serialize if the parent is being serialized as a relationship, ie, "user-id" shouldn't be returned

        static void Main(string[] args)
        {
            const string Endpoint = "http://hypermedia.cainosullivan.com";

            //const string Endpoint = "http://localhost:59074/";
            using (var client = new HypermediaSampleClient(Endpoint, ""))
            {
                //var posts = client.GetPostsAsync().Result;
                //foreach (var post in posts)
                //{
                //    Console.WriteLine(post.ViewCount);
                //}

                var post = client.GetPostByIdAsync(38).Result;
                Console.WriteLine(post.ViewCount);
                Console.WriteLine(post.OwnerUserId);
                Console.WriteLine(post.OwnerUser.DisplayName);

                foreach (var comment in post.Comments)
                {
                    Console.WriteLine("{0}: {1}", comment.Id, comment.Text);
                }
            }
        }