コード例 #1
0
        public IList <Link> GetLinks(HttpContext context, LinkGenerator url)
        {
            var links = new List <Link>();

            links.Add(home.BuildAbsolute(url, context).Link("_self"));
            links.Add(booksV1.BuildAbsolute(url, context).Link("ht:booksv1"));
            links.Add(authors.BuildAbsolute(url, context).Link("ht:authors"));

            return(links);
        }
コード例 #2
0
        public IList <Link> GetLinks()
        {
            var links = new List <Link>();

            var store = new UrlBuilder()
                        .WithAction(nameof(StoreController.Get))
                        .WithController(nameof(StoreController));

            var books = new UrlBuilder()
                        .WithAction(nameof(BooksController.Get))
                        .WithController(nameof(BooksController));

            var authors = new UrlBuilder()
                          .WithAction(nameof(AuthorsController.Get))
                          .WithController(nameof(AuthorsController));

            links.Add(store.BuildAbsolute(_generator, _context).Link(LinkRelations.Self));
            links.Add(books.BuildAbsolute(_generator, _context).Link(LinkRelations.Books));
            links.Add(authors.BuildAbsolute(_generator, _context).Link(LinkRelations.Authors));



            return(links);
        }