private async Task <Guid> CheckAndGetSlugId(string keyword, CancellationToken cancellationToken)
        {
            var slugId = await _slugManager.GetSlugIdByKeyword(keyword, cancellationToken);

            Check.That <ApplicationException>(Check.IsGuidDefaultOrEmpty(slugId), $"This slug:'{keyword}' not found.");

            var isExist = await _shortUrlRepository.IsExistBySlug(slugId, cancellationToken);

            //Check existence
            Check.That <ApplicationException>(!isExist, $"This slug:'{keyword}' not found");

            return(slugId);
        }
Example #2
0
        public async Task <bool> IsAssociated(Slug slug, CancellationToken cancellationToken = default(CancellationToken))
        {
            Check.ArgumentNotNull(slug);

            return(await _shortUrlRepository.IsExistBySlug(slug.Id, cancellationToken));
        }