Пример #1
0
        public async Task <ShortUrl> GetLatestAsync(string languageCode)
        {
            var url = await _urlService.GetLatestAsync(languageCode);

            if (url == null)
            {
                throw new InvalidOperationException("Could not find any stored URL");
            }

            var adjective = await _wordsService.GetWordByIdAsync <Adjective>(url.AdjectiveId);

            var adverb = await _wordsService.GetWordByIdAsync <Adverb>(url.AdverbId);

            var noun = await _wordsService.GetWordByIdAsync <Noun>(url.NounId);

            return(new ShortUrl
            {
                Adjective = adjective,
                Adverb = adverb,
                Noun = noun,
                BaseDomain = _baseDomain,
                DateCreated = url.DateCreated,
                TargetUrl = url.TargetUrl
            });
        }