public virtual async Task <IActionResult> OnGetAsync() { if (BlogNameControlHelper.IsProhibitedFileFormatName(BlogShortName)) { return(NotFound()); } await GetData(); return(Page()); }
public virtual async Task <ActionResult> OnGetAsync() { if (BlogNameControlHelper.IsProhibitedFileFormatName(BlogShortName)) { return(NotFound()); } Blog = await _blogAppService.GetByShortNameAsync(BlogShortName); Posts = (await _postAppService.GetListByBlogIdAndTagName(Blog.Id, TagName)).Items; PopularTags = (await _tagAppService.GetPopularTags(Blog.Id, new GetPopularTagsInput { ResultCount = 10, MinimumPostCount = 2 })); return(Page()); }
public virtual async Task <ActionResult> OnGetAsync() { if (!await _authorization.IsGrantedAsync(BloggingPermissions.Posts.Update)) { return(Redirect("/")); } if (BlogNameControlHelper.IsProhibitedFileFormatName(BlogShortName)) { return(NotFound()); } var postDto = await _postAppService.GetAsync(new Guid(PostId)); Post = ObjectMapper.Map <PostWithDetailsDto, EditPostViewModel>(postDto); Post.Tags = String.Join(", ", postDto.Tags.Select(p => p.Name).ToArray()); return(Page()); }
public virtual async Task <ActionResult> OnGetAsync() { if (!await _authorization.IsGrantedAsync(BloggingPermissions.Posts.Create)) { return(Redirect("/")); } if (BlogNameControlHelper.IsProhibitedFileFormatName(BlogShortName)) { return(NotFound()); } Blog = await _blogAppService.GetByShortNameAsync(BlogShortName); Post = new CreatePostViewModel { BlogId = Blog.Id }; return(Page()); }
public void Should_Return_False_For_Normal_Shortname(string blogShortName) { BlogNameControlHelper.IsProhibitedFileFormatName(blogShortName).ShouldBe(false); }
public void Should_Return_True_For_FileExtension_Shortname(string blogShortName) { BlogNameControlHelper.IsProhibitedFileFormatName(blogShortName).ShouldBe(true); }