diff --git a/docs/Tutorials/AspNetCore-Mvc/Part-I.md b/docs/Tutorials/AspNetCore-Mvc/Part-I.md index d6966fd82d..5de17ef142 100644 --- a/docs/Tutorials/AspNetCore-Mvc/Part-I.md +++ b/docs/Tutorials/AspNetCore-Mvc/Part-I.md @@ -157,16 +157,12 @@ namespace Acme.BookStore { [Required] [StringLength(128)] - [Display(Name = "Name")] public string Name { get; set; } - [Display(Name = "Type")] public BookType Type { get; set; } = BookType.Undefined; - [Display(Name = "PublishDate")] public DateTime PublishDate { get; set; } - [Display(Name = "Price")] public float Price { get; set; } } } diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Pages/Components/DynamicForms.cshtml.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Pages/Components/DynamicForms.cshtml.cs index 2901ade738..27075bf09a 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Pages/Components/DynamicForms.cshtml.cs +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Pages/Components/DynamicForms.cshtml.cs @@ -46,33 +46,26 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Pages.Components public class PersonModel { [Required] - [DisplayName("Name")] public string Name { get; set; } - - [DisplayName("Surname")] + [TextArea(Rows = 4)] public string Surname { get; set; } [Required] - [DisplayName("Age")] [Range(1, 100)] public int Age { get; set; } [Required] - [DisplayName("City")] public Cities City { get; set; } public PhoneModel Phone { get; set; } [DataType(DataType.Date)] - [DisplayName("Day")] [DisplayOrder(10003)] public DateTime Day { get; set; } - - [DisplayName("Is Active")] + public bool IsActive { get; set; } - - [DisplayName("Country")] + [AbpRadioButton(Inline = true)] [SelectItems(nameof(Countries))] public string Country { get; set; } @@ -82,7 +75,6 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Pages.Components { [Required] [DisplayOrder(10002)] - [DisplayName("Number")] public string Number { get; set; } [Required] diff --git a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml.cs b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml.cs index b580300dda..558215e5f9 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml.cs +++ b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml.cs @@ -147,16 +147,13 @@ namespace Volo.Abp.Account.Web.Pages.Account { [Required] [StringLength(255)] - [DisplayName(nameof(UserNameOrEmailAddress))] public string UserNameOrEmailAddress { get; set; } [Required] [StringLength(32)] [DataType(DataType.Password)] - [DisplayName(nameof(Password))] public string Password { get; set; } - - [DisplayName(nameof(RememberMe))] + public bool RememberMe { get; set; } } } diff --git a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Register.cshtml.cs b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Register.cshtml.cs index ae19ee27c4..170a783197 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Register.cshtml.cs +++ b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Register.cshtml.cs @@ -62,19 +62,16 @@ namespace Volo.Abp.Account.Web.Pages.Account { [Required] [StringLength(32)] - [DisplayName(nameof(UserName))] public string UserName { get; set; } [Required] [EmailAddress] [StringLength(255)] - [DisplayName(nameof(EmailAddress))] public string EmailAddress { get; set; } [Required] [StringLength(32)] [DataType(DataType.Password)] - [DisplayName(nameof(Password))] public string Password { get; set; } } } diff --git a/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs b/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs index 5cc2327e10..b63a817893 100644 --- a/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs +++ b/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs @@ -5,7 +5,9 @@ using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Services; using System.Collections.Generic; using Microsoft.AspNetCore.Authorization; +using Volo.Abp.Domain.Entities; using Volo.Abp.Users; +using Volo.Blogging.Blogs; namespace Volo.Blogging.Posts { diff --git a/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Posts/EfCorePostRepository.cs b/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Posts/EfCorePostRepository.cs index 307a43156c..682b71aa7e 100644 --- a/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Posts/EfCorePostRepository.cs +++ b/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Posts/EfCorePostRepository.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; +using Volo.Abp.Domain.Entities; using Volo.Abp.Domain.Repositories.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore; using Volo.Blogging.Blogs; @@ -26,7 +27,14 @@ namespace Volo.Blogging.Posts public async Task GetPostByUrl(Guid blogId, string url) { - return await DbSet.FirstOrDefaultAsync(p => p.BlogId == blogId && p.Url == url); + var post = await DbSet.FirstOrDefaultAsync(p => p.BlogId == blogId && p.Url == url); + + if (post == null) + { + throw new EntityNotFoundException(typeof(Post), nameof(post)); + } + + return post; } } } diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Detail.cshtml.cs b/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Detail.cshtml.cs index 9aab468564..abdaad9b32 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Detail.cshtml.cs +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Detail.cshtml.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; +using Volo.Abp.Domain.Entities; using Volo.Blogging.Blogs; using Volo.Blogging.Posts; @@ -32,10 +33,8 @@ namespace Volo.Blogging.Pages.Blog.Posts public async void OnGet() { - var blog = await _blogAppService.GetByShortNameAsync(BlogShortName); - - Post = await _postAppService.GetByUrlAsync(new GetPostInput {BlogId = blog.Id , Url = PostUrl}); - Blog = blog; + Blog = await _blogAppService.GetByShortNameAsync(BlogShortName); + Post = await _postAppService.GetByUrlAsync(new GetPostInput {BlogId = Blog.Id , Url = PostUrl}); } } } \ No newline at end of file diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Edit.cshtml.cs b/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Edit.cshtml.cs index 3e166ebd9d..18993f6ec3 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Edit.cshtml.cs +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Edit.cshtml.cs @@ -58,16 +58,13 @@ namespace Volo.Blogging.Pages.Blog.Posts [Required] [StringLength(PostConsts.MaxTitleLength)] - [Display(Name = "Title")] public string Title { get; set; } [Required] [StringLength(PostConsts.MaxUrlLength)] - [Display(Name = "Url")] public string Url { get; set; } [StringLength(PostConsts.MaxContentLength)] - [Display(Name = "Content")] public string Content { get; set; } } } \ No newline at end of file diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/New.cshtml.cs b/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/New.cshtml.cs index cdd3ff3c88..8a8bbe0c15 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/New.cshtml.cs +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/New.cshtml.cs @@ -52,17 +52,14 @@ namespace Volo.Blogging.Pages.Blog.Posts [Required] [StringLength(PostConsts.MaxTitleLength)] - [Display(Name = "Title")] public string Title { get; set; } [Required] [StringLength(PostConsts.MaxUrlLength)] - [Display(Name = "Url")] public string Url { get; set; } [HiddenInput] [StringLength(PostConsts.MaxContentLength)] - [Display(Name = "Content")] public string Content { get; set; } } } diff --git a/samples/BookStore/src/Acme.BookStore.Application/CreateUpdateBookDto.cs b/samples/BookStore/src/Acme.BookStore.Application/CreateUpdateBookDto.cs index a74a786682..287faf3ece 100644 --- a/samples/BookStore/src/Acme.BookStore.Application/CreateUpdateBookDto.cs +++ b/samples/BookStore/src/Acme.BookStore.Application/CreateUpdateBookDto.cs @@ -10,16 +10,12 @@ namespace Acme.BookStore { [Required] [StringLength(128)] - [Display(Name = "Name")] public string Name { get; set; } - - [Display(Name = "Type")] + public BookType Type { get; set; } = BookType.Undefined; - - [Display(Name = "PublishDate")] + public DateTime PublishDate { get; set; } - - [Display(Name = "Price")] + public float Price { get; set; } } } \ No newline at end of file