Пример #1
0
        public object Options(DiscoverCurrencies request)
        {
            IAppHost host = GetAppHost();

            var currencyLinks = Currency.FindAll()
                                .OrderBy(c => c.AlphabeticCode, StringComparer.OrdinalIgnoreCase)
                                .Where(c => !c.IsObsolete)
                                .Select(c => host.Link("currency", new Messages.Currency {
                IsoCode = c.IsoCode
            }, "GET"));

            var response = new DiscoveryResponse
            {
                _links = new[]
                {
                    host.Self(request),
                    host.Self(new Messages.Currencies(), "GET")
                }
                .Concat(currencyLinks)
                .Concat(new[] { host.Link("format", new Messages.MultiFormat {
                        Quantities = new [] { new FormatableQuantity() }
                    }, "POST") })
                .ToArray()
            };

            return(response);
        }
Пример #2
0
        public object Options(DiscoverRoot request)
        {
            IAppHost host = GetAppHost();

            var response = new DiscoveryResponse
            {
                _links = new[]
                {
                    host.Self(request),
                    host.Link("currencies", new Messages.Currencies(), "GET")
                }
            };

            return(response);
        }
Пример #3
0
        public object Options(DiscoverCurrency request)
        {
            IAppHost host = GetAppHost();

            var response = new DiscoveryResponse
            {
                _links = new[]
                {
                    host.Self(request),
                    host.Self(new Messages.Currency {
                        IsoCode = request.IsoCode
                    }, "GET"),
                    host.Parent(new Messages.Currencies(), "GET"),
                    host.Link("format", new Messages.Format {
                        IsoCode = request.IsoCode
                    }, "GET")
                }
            };

            return(response);
        }
Пример #4
0
 public static Link Self(this IAppHost host, IReturn dto)
 {
     return(host.Link("_self", dto, "OPTIONS"));
 }
Пример #5
0
 public static Link Parent(this IAppHost host, IReturn dto, string method)
 {
     return(host.Link("parent", dto, method));
 }
Пример #6
0
 public static Link Self(this IAppHost host, IReturn dto, string method)
 {
     return(host.Link("self", dto, method));
 }