48 lines
1.6 KiB
C#
48 lines
1.6 KiB
C#
using GeneralApi.Core.Common;
|
|
using GeneralApi.Core.Infrastructure.Validation.Constraints;
|
|
using NHibernate.Validator.Cfg.Loquacious;
|
|
using Taloyhtio.GeneralApi.Core.Common;
|
|
using Taloyhtio.GeneralApi.Core.Entities;
|
|
|
|
namespace GeneralApi.Core.Infrastructure.Validation
|
|
{
|
|
public class BoardMemberValidationDef : ValidationDef<BoardMember>
|
|
{
|
|
public BoardMemberValidationDef()
|
|
{
|
|
ValidateInstance.Using(new BoardMemberUniqueAttribute());
|
|
|
|
Define(x => x.Condo)
|
|
.NotNullable();
|
|
|
|
Define(x => x.FirstName)
|
|
.NotNullableAndNotEmpty()
|
|
.And
|
|
.MaxLength(Constants.DataAccess.BoardMember.FIRST_NAME_MAX_LENGTH);
|
|
|
|
Define(x => x.LastName)
|
|
.NotNullableAndNotEmpty()
|
|
.And
|
|
.MaxLength(Constants.DataAccess.BoardMember.LAST_NAME_MAX_LENGTH);
|
|
|
|
Define(x => x.Address)
|
|
.MaxLength(Constants.DataAccess.BoardMember.ADDRESS_MAX_LENGTH);
|
|
|
|
Define(x => x.Postcode)
|
|
.MaxLength(Constants.DataAccess.BoardMember.POSTCODE_MAX_LENGTH);
|
|
|
|
Define(x => x.Town)
|
|
.MaxLength(Constants.DataAccess.BoardMember.TOWN_MAX_LENGTH);
|
|
|
|
Define(x => x.FlatNumber)
|
|
.MaxLength(Constants.DataAccess.BoardMember.FLAT_NUMBER_MAX_LENGTH);
|
|
|
|
Define(x => x.Email)
|
|
.MaxLength(Constants.DataAccess.BoardMember.EMAIL_MAX_LENGTH);
|
|
|
|
Define(x => x.Mobile)
|
|
.MaxLength(Constants.DataAccess.BoardMember.MOBILE_MAX_LENGTH);
|
|
}
|
|
}
|
|
}
|