Esempio n. 1
0
            //Constructors
            #region Details
            public Details(Persistence.News news)
            {
                this.Guid         = news.Guid;
                this.Date         = news.Date;
                this.Title        = news.Title;
                this.Text         = news.Text;
                this.SourceLink   = news.SourceLink;
                this.NewsPictures = news.NewsPictures
                                    .OrderBy(runner => runner.SortOrder)
                                    .Select(runner => new Picture()
                {
                    Guid = runner.Guid, ImageLink = runner.ImageLink
                });

                this.NewsVehicles = news.NewsVehicles
                                    .SelectMany(x => x.Vehicle.BuildNames()
                                                .Select(y => new Models.NewsViewModel.Vehicle()
                {
                    VehicleNewsGuid = x.Guid,
                    VehicleGuid     = y.VehicleGuid,
                    Name            = y.Name,
                    PictureGuid     = y.PictureGuid
                }))
                                    .OrderBy(runner => runner.Name)
                                    .ToList();
            }
Esempio n. 2
0
            //Constructor
            #region Preview
            public Preview(Persistence.News news)
            {
                this.Guid  = news.Guid;
                this.Title = $"{news.Date.ToString("dd.MM.")} {news.Title}";
                this.Date  = news.Date;
                this.Text  = news.Text;

                this.TextTeaser     = String.Concat(news.Text.Take(300).ToList()) + "...";
                this.TeaserImageUrl = news.NewsPictures.OrderBy(runner => runner.SortOrder).FirstOrDefault()?.ImageLink;
            }