Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        public async Task <bool> IsAssociated(Slug slug, CancellationToken cancellationToken = default(CancellationToken))
        {
            Check.ArgumentNotNull(slug);

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