示例#1
0
        public IHttpActionResult Get()
        {
            var home = new HomeDocument();

            home.AddResource(TopicsLinkHelper.CreateLink(Request).WithHints());
            home.AddResource(DaysLinkHelper.CreateLink(Request).WithHints());
            home.AddResource(SessionsLinkHelper.CreateLink(Request).WithHints());
            home.AddResource(SpeakersLinkHelper.CreateLink(Request).WithHints());

            return(new OkResult(Request)
                   .WithCaching(new CacheControlHeaderValue()
            {
                MaxAge = new TimeSpan(0, 0, 60)
            })
                   .WithContent(new HomeContent(home)));
        }
        private Collection CreateCollection(TimeSpan duration)
        {
            var daysCollection = new Collection();

            for (int i = 1; i < duration.TotalDays; i++)
            {
                var item = new Item();

                item.Data.Add(new Data {
                    Name = "Day", Value = i.ToString()
                });
                item.Links.Add(SessionsLinkHelper.CreateLink(Request, dayno: i).ToCJLink());
                item.Links.Add(SpeakersLinkHelper.CreateLink(Request, dayno: i).ToCJLink());
                item.Links.Add(TopicsLinkHelper.CreateLink(Request, dayno: i).ToCJLink());
                daysCollection.Items.Add(item);
            }
            return(daysCollection);
        }
示例#3
0
        public IHttpActionResult Get()
        {
            //var explorer = new ApiExplorer(Configuration);
            //var descriptions = explorer.ApiDescriptions;

            //return new OkResult(Request).WithContent(new StringContent(String.Join("\n",descriptions.Select(d=> d.ID).ToArray())));

            var home = new HomeDocument();

            home.AddResource(TopicsLinkHelper.CreateLink(Request).WithHints());
            home.AddResource(DaysLinkHelper.CreateLink(Request).WithHints());
            home.AddResource(SessionsLinkHelper.CreateLink(Request).WithHints());
            home.AddResource(SpeakersLinkHelper.CreateLink(Request).WithHints());

            return(new OkResult(Request)
                   .WithCaching(new CacheControlHeaderValue()
            {
                MaxAge = new TimeSpan(0, 0, 60)
            })
                   .WithContent(new HomeContent(home)));
        }