Ejemplo n.º 1
0
        // TODO: Move to repositories
        public ActionResult PortfolioItem(int id)
        {
            using (var db = new EventeamContext())
            {
                var portfolio = db.Portfolios.FirstOrDefault(p => p.PortfolioID == id);

                if (portfolio != null)
                {
                    var content = new ProjectViewModel
                    {
                        ProjectName      = portfolio.ProjectName,
                        FormatName       = portfolio.Format.Name,
                        Сustomer         = portfolio.Сustomer,
                        Participants     = portfolio.Participants,
                        Location         = portfolio.Location,
                        Task             = portfolio.Task,
                        Implementation   = portfolio.Implementation,
                        Result           = portfolio.Result,
                        MainPhotoList    = new List <ImageViewModel>(),
                        GalleryPhotoList = new List <ImageViewModel>()
                    };

                    var portfolioPhotos = _imagesService.GetPortfolioPhotos(portfolio.FolderName, portfolio.ProjectName);
                    var sliderPhotos    = _imagesService.FilterPortfolioSliderPhotos(portfolioPhotos);

                    content.MainPhotoList    = sliderPhotos;
                    content.GalleryPhotoList = portfolioPhotos;

                    return(View(content));
                }

                return(HttpNotFound());
            }
        }