diff --git a/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/CreatePostDto.cs b/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/CreatePostDto.cs index e6716b6dd0..61f09cb1a5 100644 --- a/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/CreatePostDto.cs +++ b/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Posts/CreatePostDto.cs @@ -1,7 +1,5 @@ using System; -using System.Collections.Generic; -using System.Text; -using Volo.Abp.Application.Dtos; +using System.ComponentModel.DataAnnotations; namespace Volo.Blogging.Posts { @@ -9,8 +7,11 @@ namespace Volo.Blogging.Posts { public Guid BlogId { get; set; } + [Required] + [StringLength(PostConsts.MaxTitleLength)] public string Title { get; set; } + [StringLength(PostConsts.MaxContentLength)] public string Content { get; set; } } } diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Index.cshtml.cs b/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Index.cshtml.cs index 39291cb5a2..0562aad31a 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Index.cshtml.cs +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Index.cshtml.cs @@ -1,4 +1,3 @@ -using System; using System.Collections.Generic; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; @@ -18,7 +17,7 @@ namespace Volo.Blogging.Pages.Blog _blogAppService = blogAppService; } - public async Task OnGet() + public async Task OnGetAsync() { var result = await _blogAppService.GetListAsync(); @@ -29,6 +28,7 @@ namespace Volo.Blogging.Pages.Blog } Blogs = result.Items; + return Page(); } } diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Index.cshtml b/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Index.cshtml index 1f22986485..cb52bad3af 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Index.cshtml +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Index.cshtml @@ -7,11 +7,11 @@ Posts +Create New Post + - -Create New Post diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Index.cshtml.cs b/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Index.cshtml.cs index e9af2b77cc..d23db906fb 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Index.cshtml.cs +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Index.cshtml.cs @@ -1,10 +1,7 @@ -using System; using System.Collections.Generic; -using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; -using Volo.Abp.Application.Dtos; using Volo.Blogging.Blogs; using Volo.Blogging.Posts; @@ -27,10 +24,9 @@ namespace Volo.Blogging.Pages.Blog.Posts _blogAppService = blogAppService; } - public async Task OnGet() + public async Task OnGetAsync() { var blog = await _blogAppService.GetByShortNameAsync(BlogShortName); - Posts = _postAppService.GetListByBlogIdAsync(blog.Id).Items; } } diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/New.cshtml b/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/New.cshtml index fbd17672b0..a0e26402eb 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/New.cshtml +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/New.cshtml @@ -1,23 +1,14 @@ @page @using Volo.Blogging.Pages.Blog.Posts @model NewModel -@{ - -} - -
- - - + + +
-