示例#1
0
        public async Task <ContentResult> GetEvents()
        {
            var start = DateTime.Now.AddDays(-1);
            var end   = start.AddDays(60);
            var url   = string.Format("https://vocadb.net/api/releaseEvents?sort=Date&maxResults=100&afterDate={0:u}&beforeDate={1:u}", start, end);

            var vbEvents = await JsonHttpClient.GetObject <PartialFindResult <VdbEvent> >(url);

            var events = vbEvents.Items.Where(e => e.Date.HasValue).Select(CreateCalendarEvent);

            return(CalendarResponseFactory.CreateCalendarContentResult(Response, events, "events.ics"));
        }
示例#2
0
        public async Task <ContentResult> GetAlbums()
        {
            var start = DateTime.Now.AddDays(-1);
            var end   = start.AddDays(60);
            var url   = string.Format("https://vocadb.net/api/albums?sort=ReleaseDate&maxResults=100&releaseDateAfter={0:u}&releaseDateBefore={1:u}", start, end);

            var albums = await JsonHttpClient.GetObject <PartialFindResult <Album> >(url);

            var events = albums.Items.Select(CreateCalendarEvent);

            return(CalendarResponseFactory.CreateCalendarContentResult(Response, events, "albums.ics"));
        }