public async Task <IActionResult> Details(string id)
        {
            // Parse everything till the first '-' as integer into `caseId`
            int.TryParse(id.Split('-', 2)[0], out int caseId);

            var caseItem = await _caseRepository.Get(caseId);

            if (caseItem == null || caseItem.Deleted || !caseItem.Enabled)
            {
                return(NotFound());
            }

            var language = HttpContext?.Features?.Get <IRequestCultureFeature>()?.RequestCulture?.Culture
                           ?.TwoLetterISOLanguageName ?? "nl";

            if (caseItem.Language != language)
            {
                int itemTranslationId;
                itemTranslationId = language == "nl" ?
                                    (await _itemTranslationRepository.GetAllCases()).FirstOrDefault(c => c.IdEn == caseItem.Id).IdNl :
                                    (await _itemTranslationRepository.GetAllCases()).FirstOrDefault(c => c.IdNl == caseItem.Id).IdEn;
                caseItem = await _caseRepository.Get(itemTranslationId);
            }

            if (caseItem == null || caseItem.Deleted || !caseItem.Enabled)
            {
                return(NotFound());
            }

            // Force the right slug
            if (id != caseItem.Slug)
            {
                return(RedirectToAction("Details", new { id = caseItem.Slug }));
            }

            var(previous, next) = await GetAdjacent(caseItem);

            var relatedItems = await _relatedItemsRepository.GetRelatedItems(caseItem.Id, Enumeration.ContentItemType.Case, caseItem.Language);

            return(View(new CaseDetailViewModel
            {
                CaseItem = caseItem,
                ContentItems = relatedItems,
                Next = next,
                Previous = previous
            }));
        }
        public async Task <IActionResult> Details(string id)
        {
            // Parse everything till the first '-' as integer into `solutionId`
            int.TryParse(id.Split('-', 2)[0], out int solutionId);

            var solutionItem = await _solutionRepository.Get(solutionId, false);

            if (solutionItem == null || solutionItem.Deleted || !solutionItem.Enabled)
            {
                return(NotFound());
            }

            var language = HttpContext?.Features?.Get <IRequestCultureFeature>()?.RequestCulture?.Culture
                           ?.TwoLetterISOLanguageName ?? "nl";

            if (solutionItem.Language != language)
            {
                int itemTranslationId;
                itemTranslationId = language == "nl" ?
                                    (await _itemTranslationRepository.GetAllSolutions()).FirstOrDefault(s => s.IdEn == solutionItem.Id).IdNl :
                                    (await _itemTranslationRepository.GetAllSolutions()).FirstOrDefault(s => s.IdNl == solutionItem.Id).IdEn;
                solutionItem = await _solutionRepository.Get(itemTranslationId);
            }
            if (solutionItem == null || solutionItem.Deleted || !solutionItem.Enabled)
            {
                return(NotFound());
            }

            if (id != solutionItem.Slug)
            {
                return(RedirectToAction("Details", new { id = solutionItem.Slug }));
            }

            var relatedItems =
                await _relatedItemsRepository.GetRelatedItems(solutionItem.Id, Enumeration.ContentItemType.Solution, language);

            var relatedCustomers = solutionItem.CustomerSolutions.Select(cs => cs.Customer).Where(c => !c.Deleted && c.Enabled).Take(12).ToList();

            return(View(new SolutionDetailViewModel
            {
                Solution = solutionItem,
                ContentItems = relatedItems,
                Customers = relatedCustomers
            }));
        }
        public async Task <IActionResult> Details(string id)
        {
            // Parse everything till the first '-' as integer into `caseId`
            int.TryParse(id.Split('-', 2)[0], out int newsItemId);

            var newsItem = await _newsItemRepository.Get(newsItemId);

            if (newsItem == null || newsItem.Deleted || !newsItem.Enabled)
            {
                return(NotFound());
            }

            var language = HttpContext?.Features?.Get <IRequestCultureFeature>()?.RequestCulture?.Culture
                           ?.TwoLetterISOLanguageName ?? "nl";

            if (newsItem.Language != language)
            {
                int itemTranslationId;
                itemTranslationId = language == "nl" ?
                                    (await _itemTranslationRepository.GetAllNewsitems()).FirstOrDefault(n => n.IdEn == newsItem.Id).IdNl :
                                    (await _itemTranslationRepository.GetAllNewsitems()).FirstOrDefault(n => n.IdNl == newsItem.Id).IdEn;
                newsItem = await _newsItemRepository.Get(itemTranslationId);
            }
            if (newsItem == null || newsItem.Deleted || !newsItem.Enabled)
            {
                return(NotFound());
            }

            // Force the right slug
            if (id != newsItem.Slug)
            {
                return(RedirectToAction("Details", new { id = newsItem.Slug }));
            }

            var relatedItems = await _relatedItemsRepository.GetRelatedItems(newsItem.Id, Enumeration.ContentItemType.NewsItem, language);

            return(View(new NewsItemDetailViewModel
            {
                NewsItem = newsItem,
                ContentItems = relatedItems,
            }));
        }