pull/400/head
Halil ibrahim Kalkan 7 years ago
commit a885a08215

@ -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; }
}
}

@ -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]

@ -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; }
}
}

@ -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; }
}
}

@ -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
{

@ -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<Post> 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;
}
}
}

@ -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});
}
}
}

@ -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; }
}
}

@ -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; }
}
}

@ -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; }
}
}
Loading…
Cancel
Save