示例#1
0
        public LinksHeader CreateLinks(string id, PaginationMetadata pagination, string routeName)
        {
            var _operationLinks = new OperationLinks()
            {
                Single = new SingleOperationLinks()
                {
                    Get  = _urlHelper.Link(GetSingleRouteName, new { id }),
                    Post = _urlHelper.Link(PostSingleRouteName, new { })
                },
                Multiple = new MultipleOperationLinks()
                {
                    Get = _urlHelper.Link(GetMultipleRouteName, new { })
                }
            };
            RelationLinks _relationLinks = null;

            if (id != null)
            {
                _relationLinks = new RelationLinks()
                {
                    Children = new RelatedChildLinks()
                    {
                        Events = _urlHelper.Link(EventsController.GetMultipleRouteName, new { incidentId = id })
                    }
                };
            }

            return(new LinksHeader(null, pagination, _urlHelper, routeName, _operationLinks, _relationLinks));
        }
示例#2
0
        public LinksHeader CreateLinks(string id, string incidentId, EventFilters filter, PaginationMetadata pagination, string routeName)
        {
            var _operationLinks = new OperationLinks()
            {
                Single = new SingleOperationLinks()
                {
                    Get  = _urlHelper.Link(GetSingleRouteName, new { id }),
                    Post = _urlHelper.Link(PostSingleRouteName, new { })
                },
                Multiple = new MultipleOperationLinks()
                {
                    Get = _urlHelper.Link(GetMultipleRouteName, new { })
                }
            };
            var _relationLinks = new RelationLinks()
            {
                Parent = new RelatedParentLinks()
                {
                    Incident = _urlHelper.Link(IncidentsController.GetSingleRouteName, new { id = incidentId })
                }
            };

            return(new LinksHeader(filter, pagination, _urlHelper, routeName, _operationLinks, _relationLinks));
        }