예제 #1
0
        public async Task <HttpResponse> Get(string slug = "", string searchTerm = "", string searchFolder = "", string currentUrl = "")
        {
            var url          = _urlGenerator.UrlFor <Article>(slug);
            var httpResponse = await _httpClient.Get(url, authenticationHeaders);

            if (!httpResponse.IsSuccessful())
            {
                return(httpResponse);
            }

            var model   = HttpResponse.Build <Article>(httpResponse);
            var article = (Article)model.Content;
            var bucket  = new S3BucketSearch();

            bucket.Files        = new List <string>();
            bucket.Folders      = new List <string>();
            bucket.Slug         = slug;
            bucket.SearchTerm   = searchTerm;
            bucket.SearchFolder = searchFolder;
            bucket.AWSLink      = ServiceUrl;
            bucket.S3Bucket     = BucketName;
            bucket.CurrentUrl   = currentUrl;
            if (!string.IsNullOrEmpty(searchTerm) && !string.IsNullOrEmpty(searchFolder))
            {
                bucket.Files = await ListFilesIn(searchFolder, searchTerm);
            }
            article.S3Bucket = bucket;

            var processedModel = _articleFactory.Build(article);

            return(HttpResponse.Successful(200, processedModel));
        }
예제 #2
0
 public ProcessedArticle(string title, string slug, string body, string teaser, string metaDescription,
                         IEnumerable <ProcessedSection> sections, string icon, string backgroundImage, string image, IEnumerable <Crumb> breadcrumbs,
                         IEnumerable <Alert> alerts, Topic topic, IEnumerable <Alert> alertsInline, S3BucketSearch s3BucketSearch, DateTime updatedAt, bool hideLastUpdated)
 {
     Title           = title;
     NavigationLink  = TypeRoutes.GetUrlFor("article", slug);
     Body            = body;
     Teaser          = teaser;
     MetaDescription = metaDescription;
     Sections        = sections;
     Icon            = icon;
     BackgroundImage = backgroundImage;
     Image           = image;
     Breadcrumbs     = breadcrumbs;
     Alerts          = alerts;
     ParentTopic     = topic;
     AlertsInline    = alertsInline;
     S3BucketSearch  = s3BucketSearch;
     UpdatedAt       = updatedAt;
     HideLastUpdated = hideLastUpdated;
 }