protected async Task SubmitAsync() { Blog.Slug = Blog.Name.ToSlug(); var existingBlog = await NodeService.GetBySlugAsync( Constants.BlogsModule, Constants.BlogType, Blog.Slug, true); if (existingBlog == null || existingBlog.Id == Blog.Id) { var contentActivity = new ContentActivity() { Node = Blog, Message = $"Updated blog: {Blog.Name}." }; await NodeService.UpdateAsync(contentActivity); NavigationManager.NavigateTo($"blog/{Blog.Slug}", true); } else { ValidationMessage = "A similar name already exists."; } }
protected override async Task OnParametersSetAsync() { var node = await NodeService.GetBySlugAsync( Constants.BlogsModule, Constants.PostType, Slug); Post = Models.Post.Create(node); var blog = await NodeService.GetAsync(Post.BlogId); Blog = Models.Blog.Create(blog); var loggedInUserId = (await AuthenticationStateTask).LoggedInUserId(); var createdBy = node.CreatedBy; CanEditPost = await SecurityService.AllowedAsync( loggedInUserId, createdBy, Constants.BlogsModule, Constants.BlogType, Actions.Add ); CanDeletePost = await SecurityService.AllowedAsync( loggedInUserId, createdBy, Constants.BlogsModule, Constants.BlogType, Actions.Delete ); }
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."; } }
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."; } }
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() { Article.Slug = Article.Title.ToSlug(); var existingArticle = await NodeService.GetBySlugAsync( Constants.ArticlesModule, Constants.ArticleType, Article.Slug, true); if (existingArticle == null || existingArticle.Id == Article.Id) { var contentActivity = new ContentActivity() { Node = Article, Message = $"Updated an article: {Article.Title}." }; await NodeService.UpdateAsync(contentActivity); NavigationManager.NavigateTo($"article/{Article.Slug}", true); } else { ValidationMessage = "A similar title already exists."; } }
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 = $"Edited a video channel: {Channel.Name}." }; await NodeService.UpdateAsync(contentActivity); NavigationManager.NavigateTo($"videos/{Channel.Slug}"); } else { ValidationMessage = "A similar name already exists."; } }
protected override async Task OnParametersSetAsync() { var node = await NodeService.GetBySlugAsync( Constants.ArticlesModule, Constants.ArticleType, Slug); Article = Models.Article.Create(node); var loggedInUserId = (await AuthenticationStateTask).LoggedInUserId(); var createdBy = node.CreatedBy; CanEditArticle = await SecurityService.AllowedAsync( loggedInUserId, createdBy, Constants.ArticlesModule, Constants.ArticleType, Actions.Edit ); CanDeleteArticle = await SecurityService.AllowedAsync( loggedInUserId, createdBy, Constants.ArticlesModule, Constants.ArticleType, Actions.Delete ); var categoryNode = await NodeService.GetAsync(Article.CategoryId); Category = Models.Category.Create(categoryNode); }
protected override async Task OnParametersSetAsync() { var node = await NodeService.GetBySlugAsync( Constants.ForumsModule, Constants.ForumType, Slug); Forum = Models.Forum.Create(node); }
protected override async Task OnParametersSetAsync() { var profile = await NodeService.GetBySlugAsync( Constants.ProfilesModule, Constants.ProfileType, Slug); Profile = Models.Profile.Create(profile); }
protected override async Task OnParametersSetAsync() { var blog = await NodeService.GetBySlugAsync( Constants.BlogsModule, Constants.BlogType, Slug); Blog = Models.Blog.Create(blog); }
protected override async Task OnParametersSetAsync() { var node = await NodeService.GetBySlugAsync( Constants.ArticlesModule, Constants.CategoryType, Slug, true); Category = Models.Category.Create(node); }
protected override async Task OnParametersSetAsync() { _editContext = new EditContext(Profile); _messages = new ValidationMessageStore(_editContext); var profile = await NodeService.GetBySlugAsync( Constants.ProfilesModule, Constants.ProfileType, Slug); Profile = Models.Profile.Create(profile); }
protected override async Task OnParametersSetAsync() { Categories = await CategoryService.GetAllAsync(Constants.ArticlesModule); Categories = Categories.OrderBy(c => c.Name); var article = await NodeService.GetBySlugAsync( Constants.ArticlesModule, Constants.ArticleType, Slug); Article = Models.Article.Create(article); }
protected override async Task OnParametersSetAsync() { var node = await NodeService.GetBySlugAsync( Constants.ForumsModule, Constants.ForumType, Slug); Forum = Models.Forum.Create(node); var createdBy = node.CreatedBy; Topics = new TopicsModel(NodeService) { NodeSearch = new NodeSearch() { Module = Constants.ForumsModule, Type = Constants.TopicType, ParentId = node.Id, OrderBy = new string[] { OrderBy.Hot, OrderBy.Latest } } }; await Topics.InitAsync(); var loggedInUserId = (await AuthenticationStateTask).LoggedInUserId(); CanEditForum = await SecurityService.AllowedAsync( loggedInUserId, createdBy, Constants.ForumsModule, Constants.ForumType, Actions.Edit ); CanDeleteForum = await SecurityService.AllowedAsync( loggedInUserId, createdBy, Constants.ForumsModule, Constants.ForumType, Actions.Delete ); CanAddTopic = await SecurityService.AllowedAsync( loggedInUserId, null, Constants.ForumsModule, Constants.TopicType, Actions.Add ); }
protected override async Task OnParametersSetAsync() { _editContext = new EditContext(Channel); _messages = new ValidationMessageStore(_editContext); var node = await NodeService.GetBySlugAsync( Constants.VideosModule, Constants.ChannelType, Slug); Channel = Models.Channel.Create(node); base.OnInitialized(); }
protected override async Task OnParametersSetAsync() { var node = await NodeService.GetBySlugAsync( Constants.VideosModule, Constants.ChannelType, Slug); Channel = Models.Channel.Create(node); var loggedInUserId = (await AuthenticationStateTask).LoggedInUserId(); var createdBy = node.CreatedBy; CanEditChannel = await SecurityService.AllowedAsync( loggedInUserId, createdBy, Constants.VideosModule, Constants.ChannelType, Actions.Add ); CanDeleteChannel = await SecurityService.AllowedAsync( loggedInUserId, createdBy, Constants.VideosModule, Constants.ChannelType, Actions.Delete ); CanAddVideo = await SecurityService.AllowedAsync( loggedInUserId, createdBy, Constants.VideosModule, Constants.VideoType, Actions.Add ); Videos = new VideosModel(NodeService) { NodeSearch = new NodeSearch() { Module = Constants.VideosModule, Type = Constants.VideoType, ParentId = Channel.Id, OrderBy = $"{OrderBy.Weight},{OrderBy.Latest},{OrderBy.Title}" } }; await Videos.InitAsync(); }
protected override async Task OnParametersSetAsync() { var blog = await NodeService.GetBySlugAsync( Constants.BlogsModule, Constants.BlogType, Slug); Blog = Models.Blog.Create(blog); Posts = new PostsModel(NodeService) { NodeSearch = new NodeSearch() { Module = Constants.BlogsModule, Type = Constants.PostType, ParentId = Blog.Id, OrderBy = $"{OrderBy.Weight},{OrderBy.Latest},{OrderBy.Title}", TruncateContent = 140 } }; await Posts.InitAsync(); var loggedInUserId = (await AuthenticationStateTask).LoggedInUserId(); CanEditBlog = await SecurityService.AllowedAsync( loggedInUserId, null, Constants.BlogsModule, Constants.BlogType, Actions.Add ); CanDeleteBlog = await SecurityService.AllowedAsync( loggedInUserId, null, Constants.BlogsModule, Constants.BlogType, Actions.Delete ); CanAddPost = await SecurityService.AllowedAsync( loggedInUserId, null, Constants.BlogsModule, Constants.PostType, Actions.Add ); }
protected override async Task OnParametersSetAsync() { var nodeSearch = new NodeSearch() { Module = Constants.ArticlesModule, Type = Constants.CategoryType, OrderBy = $"{OrderBy.Title}" }; var nodes = await NodeService.GetAsync(nodeSearch, 0); Categories = nodes.ToArray().ConvertTo <Models.Category>(); var article = await NodeService.GetBySlugAsync( Constants.ArticlesModule, Constants.ArticleType, Slug); Article = Models.Article.Create(article); }
protected override async Task OnParametersSetAsync() { var node = await NodeService.GetBySlugAsync( Constants.ProfilesModule, Constants.ProfileType, Slug); Profile = Profile.Create(node); var loggedInUserId = (await AuthenticationStateTask).LoggedInUserId(); var createdBy = node.CreatedBy; CanEditProfile = await SecurityService.AllowedAsync( loggedInUserId, createdBy, Constants.ProfilesModule, Constants.ProfileType, Actions.Add ); }
protected override async Task OnParametersSetAsync() { _editContext = new EditContext(Category); _messages = new ValidationMessageStore(_editContext); base.OnInitialized(); if (!string.IsNullOrEmpty(ParentSlug)) { var node = await NodeService.GetBySlugAsync( Constants.ArticlesModule, Constants.CategoryType, ParentSlug); if (node != null) { ParentCategory = Models.Category.Create(node); Category.ParentId = ParentCategory.Id; } } await base.OnParametersSetAsync(); }
protected override async Task OnParametersSetAsync() { var loggedInUserId = (await AuthenticationStateTask).LoggedInUserId(); if (string.IsNullOrEmpty(Slug) && !string.IsNullOrEmpty(loggedInUserId)) { Slug = await UserApiService.GetUserNameAsync(loggedInUserId); } if (!string.IsNullOrEmpty(Slug)) { var node = await NodeService.GetBySlugAsync( Constants.ProfilesModule, Constants.ProfileType, Slug); if (node != null) { Profile = Profile.Create(node); var createdBy = node.CreatedBy; CanEditProfile = await SecurityService.AllowedAsync( loggedInUserId, createdBy, Constants.ProfilesModule, Constants.ProfileType, Actions.Add ); } else { NavigationManager.NavigateTo("profile/in/new"); } } else { NavigationManager.NavigateTo("/"); } }
protected async Task SubmitAsync() { var existingCategory = await NodeService.GetBySlugAsync( Constants.ArticlesModule, Constants.CategoryType, Category.Slug, true); if (existingCategory == null || existingCategory.Id == Category.Id) { var contentActivity = new ContentActivity() { Node = Category, Message = $"Added a new article category: {Category.Name}." }; await NodeService.UpdateAsync(contentActivity); NavigationManager.NavigateTo($"articles/{Category.Slug}", true); } else { ValidationMessage = "A similar name already exists."; } }
protected async Task SubmitAsync() { Blog.Slug = Blog.Name.ToSlug(); var existingArticle = await NodeService.GetBySlugAsync( Constants.BlogsModule, Constants.BlogType, Blog.Slug); 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."; } }
protected override async Task OnParametersSetAsync() { var node = await NodeService.GetBySlugAsync( Constants.ArticlesModule, Constants.CategoryType, Slug); Category = Models.Category.Create(node); if (!string.IsNullOrEmpty(Category.ParentId)) { var parentNode = await NodeService.GetAsync(Category.ParentId); if (parentNode != null) { ParentCategory = Models.Category.Create(parentNode); } } var nodeSearch = new NodeSearch() { Module = Constants.ArticlesModule, Type = Constants.CategoryType, ParentId = Category.Id, OrderBy = $"{OrderBy.Weight},{OrderBy.Title}" }; var nodes = await NodeService.GetAsync(nodeSearch, 0); Categories = nodes.ConvertTo <Models.Category>(); Articles = new ArticlesModel(NodeService) { NodeSearch = new NodeSearch() { Module = Constants.ArticlesModule, Type = Constants.ArticleType, ParentId = Category.Id, OrderBy = $"{OrderBy.Weight},{OrderBy.Latest},{OrderBy.Title}", TruncateContent = 140 } }; await Articles.InitAsync(); var loggedInUserId = (await AuthenticationStateTask).LoggedInUserId(); CanAddCategory = await SecurityService.AllowedAsync( loggedInUserId, null, Constants.ArticlesModule, Constants.CategoryType, Actions.Add ); CanEditCategory = await SecurityService.AllowedAsync( loggedInUserId, null, Constants.ArticlesModule, Constants.CategoryType, Actions.Add ); CanDeleteCategory = await SecurityService.AllowedAsync( loggedInUserId, null, Constants.ArticlesModule, Constants.CategoryType, Actions.Delete ); CanAddArticle = await SecurityService.AllowedAsync( loggedInUserId, null, Constants.ArticlesModule, Constants.ArticleType, Actions.Add ); }
protected override async Task OnParametersSetAsync() { var category = await NodeService.GetBySlugAsync(Constants.ArticlesModule, Constants.CategoryType, CategorySlug); Article.CategoryId = category.Id; }
protected override async Task OnParametersSetAsync() { var node = await NodeService.GetBySlugAsync( Constants.ForumsModule, Constants.ForumType, Slug); Forum = Models.Forum.Create(node); var createdBy = node.CreatedBy; if (!string.IsNullOrEmpty(Forum.ParentId)) { var parentNode = await NodeService.GetAsync(Forum.ParentId); if (parentNode != null) { ParentForum = Models.Forum.Create(parentNode); } } else { ParentForum = null; } Forums = new ForumsModel(NodeService) { NodeSearch = new NodeSearch() { Module = Constants.ForumsModule, Type = Constants.ForumType, OrderBy = $"{OrderBy.Title}", ParentId = node.Id } }; await Forums.InitAsync(); var loggedInUserId = (await AuthenticationStateTask).LoggedInUserId(); CanAddForum = await SecurityService.AllowedAsync( loggedInUserId, null, Constants.ForumsModule, Constants.ForumType, Actions.Add ); Topics = new TopicsModel(NodeService) { NodeSearch = new NodeSearch() { Module = Constants.ForumsModule, Type = Constants.TopicType, ParentId = node.Id, OrderBy = $"{OrderBy.Hot},{OrderBy.Latest}", TruncateContent = 140 } }; await Topics.InitAsync(); CanEditForum = await SecurityService.AllowedAsync( loggedInUserId, createdBy, Constants.ForumsModule, Constants.ForumType, Actions.Edit ); CanDeleteForum = await SecurityService.AllowedAsync( loggedInUserId, createdBy, Constants.ForumsModule, Constants.ForumType, Actions.Delete ); CanAddTopic = await SecurityService.AllowedAsync( loggedInUserId, null, Constants.ForumsModule, Constants.TopicType, Actions.Add ); }