Пример #1
0
            private async Task DeactiveSlug(Guid slugId)
            {
                var slug = await _slugRepository.Get(slugId);

                if (Check.IsNotNull(slug))
                {
                    slug.DeActivate();

                    await _slugRepository.Update(slug);
                }
            }
Пример #2
0
            public async Task Handle(ShortUrlCreated notification, CancellationToken cancellationToken)
            {
                //TODO: Log
                if (!Check.IsGuidDefaultOrEmpty(notification.ShortUrl.Id))
                {
                    var slug = await _slugRepository.Get(notification.ShortUrl.SlugId);

                    //Activate slug
                    slug.UpdatedBy   = notification.ShortUrl.UpdatedBy;
                    slug.UpdatedDate = notification.ShortUrl.UpdatedDate;

                    if (!Check.IsGuidDefaultOrEmpty(notification.ShortUrl.Id))
                    {
                        slug.Activate();
                    }

                    await _slugRepository.Update(slug, cancellationToken);
                }
            }
Пример #3
0
            public async Task Handle(ShortUrlsCreated notification, CancellationToken cancellationToken)
            {
                if (notification.ShortUrls.Any(s => !Check.IsGuidDefaultOrEmpty(s.Id)))
                {
                    foreach (var shortUrl in notification.ShortUrls.Where(s => !Check.IsGuidDefaultOrEmpty(s.Id)))
                    {
                        var slug = await _slugRepository.Get(shortUrl.SlugId);

                        //Activate ShortKey
                        slug.Activate();

                        slug.UpdatedBy   = shortUrl.UpdatedBy;
                        slug.UpdatedDate = shortUrl.UpdatedDate;

                        //Update
                        await _slugRepository.Update(slug, cancellationToken);
                    }
                }
            }