コード例 #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
ファイル: ShortUrlCreated.cs プロジェクト: Yawlurl/Yawlurl
            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
ファイル: ShortUrlsCreated.cs プロジェクト: Yawlurl/Yawlurl
            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);
                    }
                }
            }