Пример #1
0
        protected async Task SubmitAsync()
        {
            Post.Slug = Post.Title.ToSlug();
            var existingPost = await NodeService.GetBySlugAsync(
                Constants.BlogsModule,
                Constants.PostType,
                Post.Slug,
                true);

            if (existingPost == null)
            {
                var contentActivity = new ContentActivity()
                {
                    Node    = Post,
                    Message = $"Added a new post: {Post.Title}."
                };
                await NodeService.AddAsync(contentActivity);

                NavigationManager.NavigateTo($"blog/post/{Post.Slug}");
            }
            else
            {
                ValidationMessage = "A similar name already exists.";
            }
        }
Пример #2
0
        protected async Task SubmitAsync()
        {
            var existingCategory = await NodeService.GetBySlugAsync(
                Constants.ArticlesModule,
                Constants.CategoryType,
                Category.Slug,
                true);

            if (existingCategory == null)
            {
                var contentActivity = new ContentActivity()
                {
                    Node    = Category,
                    Message = $"Added a new article category: {Category.Name}."
                };
                var response = await NodeService.AddAsync(contentActivity);

                if (response.StatusCode == HttpStatusCode.OK)
                {
                    NavigationManager.NavigateTo($"articles/{Category.Slug}");
                }
                else
                {
                    ValidationMessage = "Unable to save.";
                }
            }
            else
            {
                ValidationMessage = "A similar name already exists.";
            }
        }
Пример #3
0
        protected async Task SubmitAsync()
        {
            Forum.ParentId = ParentId;
            var existingForum = await NodeService.GetBySlugAsync(
                Constants.ForumsModule,
                Constants.ForumType,
                Forum.Name,
                true);

            if (existingForum == null)
            {
                var contentActivity = new ContentActivity()
                {
                    Node    = Forum,
                    Message = $"Added a new forum: {Forum.Name}."
                };
                await NodeService.AddAsync(contentActivity);

                NavigationManager.NavigateTo($"forum/{Forum.Slug}");
            }
            else
            {
                ValidationMessage = "A similar title already exists.";
            }
        }
        protected async Task SubmitAsync()
        {
            if (!string.IsNullOrEmpty(Comment.Content) &&
                Comment.Content != PreviousComment)
            {
                if (Id == null)
                {
                    Comment.PostId = PostId;
                    var contentActivity = new ContentActivity()
                    {
                        Node    = Comment,
                        Message = $"Added a new forum comment: {Comment.Snippet}"
                    };
                    await NodeService.AddAsync(contentActivity);
                }
                else
                {
                    var contentActivity = new ContentActivity()
                    {
                        Node    = Comment,
                        Message = $"Updated a new forum comment: {Comment.Snippet}"
                    };
                    await NodeService.UpdateAsync(contentActivity);
                }
                await OnSave.InvokeAsync(Comment);

                PreviousComment = Comment.Content;
                Comment.Content = string.Empty;
            }
        }
Пример #5
0
        protected async Task SubmitAsync()
        {
            Article.Slug = Article.Title.ToSlug();
            var existingArticle = await NodeService.GetBySlugAsync(
                Constants.ArticlesModule,
                Constants.ArticleType,
                Article.Slug,
                true);

            if (existingArticle == null)
            {
                var contentActivity = new ContentActivity()
                {
                    Node    = Article,
                    Message = $"Added a new article: {Article.Title}."
                };
                await NodeService.AddAsync(contentActivity);

                NavigationManager.NavigateTo($"article/{Article.Slug}");
            }
            else
            {
                ValidationMessage = "A similar title already exists.";
            }
        }
Пример #6
0
        protected async Task SubmitAsync()
        {
            Channel.Slug = Channel.Name.ToSlug();
            var existingChannel = await NodeService.GetBySlugAsync(
                Constants.VideosModule,
                Constants.ChannelType,
                Channel.Slug,
                true);

            if (existingChannel == null)
            {
                var contentActivity = new ContentActivity()
                {
                    Node    = Channel,
                    Message = $"Added a new video channel: {Channel.Name}."
                };
                await NodeService.AddAsync(contentActivity);

                NavigationManager.NavigateTo($"videos/{Channel.Slug}");
            }
            else
            {
                ValidationMessage = "A similar name already exists.";
            }
        }
Пример #7
0
        protected async Task SubmitAsync()
        {
            Blog.Slug = Blog.Name.ToSlug();
            var existingArticle = await NodeService.GetBySlugAsync(
                Constants.BlogsModule,
                Constants.BlogType,
                Blog.Slug,
                true);

            if (existingArticle == null)
            {
                var contentActivity = new ContentActivity()
                {
                    Node    = Blog,
                    Message = $"Added a new blog: {Blog.Name}."
                };
                await NodeService.AddAsync(contentActivity);

                NavigationManager.NavigateTo($"blog/{Blog.Slug}");
            }
            else
            {
                ValidationMessage = "A similar name already exists.";
            }
        }
Пример #8
0
        protected async Task SubmitAsync()
        {
            var contentActivity = new ContentActivity()
            {
                Node    = Profile,
                Message = $"Created the profile: {Profile.Slug}."
            };
            await NodeService.AddAsync(contentActivity);

            NavigationManager.NavigateTo($"profile/in/{Profile.Slug}");
        }
Пример #9
0
        protected async Task SubmitAsync()
        {
            var contentActivity = new ContentActivity()
            {
                Node    = Topic,
                Message = $"Added a new forum topic: {Topic.Snippet}"
            };
            await NodeService.AddAsync(contentActivity);

            NavigationManager.NavigateTo($"forum/topic/{Topic.Id}");
        }
Пример #10
0
        protected async Task SubmitAsync()
        {
            await VideoService.SetVideoAttributesAsync(Video);

            var contentActivity = new ContentActivity()
            {
                Node    = Video,
                Message = $"Added a new video: {Video.Url}."
            };
            await NodeService.AddAsync(contentActivity);

            if (SetAsChannelThumbnail)
            {
                Channel.ThumbnailUrl = Video.ThumbnailUrl;
                contentActivity      = new ContentActivity()
                {
                    Node    = Channel,
                    Message = $"Updated a video channel: {Channel.Name}."
                };
                await NodeService.UpdateAsync(contentActivity);
            }
            NavigationManager.NavigateTo($"video/{Video.Id}");
        }
Пример #11
0
        protected async Task SubmitAsync()
        {
            if (string.IsNullOrEmpty(Id))
            {
                Post.TopicId = TopicId;
                var contentActivity = new ContentActivity()
                {
                    Node    = Post,
                    Message = $"Added a new forum post: {Post.Snippet}"
                };
                await NodeService.AddAsync(contentActivity);
            }
            else
            {
                var contentActivity = new ContentActivity()
                {
                    Node    = Post,
                    Message = $"Updated a forum post: {Post.Snippet}"
                };
                await NodeService.UpdateAsync(contentActivity);
            }

            await OnSave.InvokeAsync(Post);
        }