Ejemplo n.º 1
0
            public override void OnActionExecuted(ActionExecutedContext context)
            {
                base.OnActionExecuted(context);

                if (context.Result is ViewResult viewResult)
                {
                    viewResult.ViewData[Constants.ViewData.ApplicationInfo] = _applicationInfoProvider.Provide();
                }
            }
        public async Task <IActionResult> GetDefault()
        {
            var response = new ApiHomeResponse {
                ApplicationInfo = _applicationInfoProvider.Provide()
            };
            await _apiHomeResponseLinksCreatorFactory.Create().CreateLinksFor(response);

            return(Ok(response));
        }
Ejemplo n.º 3
0
        public Uri Resolve()
        {
            string Normalize(string url)
            {
                return(string.IsNullOrEmpty(url) ? string.Empty
                    : url.StartsWith("/") ? url.ToLowerInvariant().Substring(1) : url.ToLowerInvariant());
            }

            var applicationInfo = _applicationInfoProvider.Provide();
            var sitePath        = applicationInfo.UrlInfo.SiteUrl;
            var applicationPath = Normalize(applicationInfo.UrlInfo.AppUrl);

            var baseUrl = $"{sitePath.TrimEnd('/')}/{applicationPath.TrimEnd('/')}";

            baseUrl = $"{baseUrl.TrimEnd('/')}/";

            return(new Uri(baseUrl, UriKind.Absolute));
        }