Using YaStringLength and YaRequired

This commit is contained in:
Paul Schneider 2019-09-04 01:25:36 +01:00
commit 9457ba71d1
62 changed files with 396 additions and 150 deletions

View file

@ -1,18 +1,19 @@
using System.ComponentModel.DataAnnotations;
using Yavsc.Attributes.Validation;
namespace Yavsc.Models.Account { 
public class ChangePasswordBindingModel {
[Required]
[YaRequired]
[DataType(DataType.Password)]
public string OldPassword { get; set; }
[Required]
[YaRequired]
[DataType(DataType.Password)]
public string NewPassword { get; set; }
}
public class SetPasswordBindingModel {
[Required]
[YaRequired]
[DataType(DataType.Password)]
public string NewPassword { get; set; }

View file

@ -6,12 +6,12 @@ namespace Yavsc.ViewModels.Account
{
public class ExternalLoginConfirmationViewModel
{
[Required]
[YaRequired]
[YaStringLength(2,Constants.MaxUserNameLength)]
[YaRegularExpression(Constants.UserNameRegExp)]
public string Name { get; set; }
[Required]
[YaRequired]
[EmailAddress]
public string Email { get; set; }

View file

@ -1,12 +1,13 @@
using System.ComponentModel.DataAnnotations;
using Yavsc.Attributes.Validation;
namespace Yavsc.ViewModels.Account
{
public class ForgotPasswordViewModel
{
[Required]
[StringLength(512)]
[YaRequired]
[YaStringLength(512)]
public string LoginOrEmail { get; set; }
}
}

View file

@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Yavsc.Attributes.Validation;
namespace Yavsc.ViewModels.Account
{
@ -10,14 +11,14 @@ namespace Yavsc.ViewModels.Account
/// Local user's name.
/// </summary>
/// <returns></returns>
[Required]
[YaRequired]
public string UserName { get; set; }
/// <summary>
/// Local user's password .
/// </summary>
/// <returns></returns>
[Required]
[YaRequired]
[DataType(DataType.Password)]
public string Password { get; set; }

View file

@ -11,7 +11,7 @@ namespace Yavsc.ViewModels.Account
[YaRegularExpression(Constants.UserNameRegExp)]
public string UserName { get; set; }
[Required()]
[YaRequired()]
[YaStringLength(2,102)]
// [EmailAddress]
[Display(Name = "Email")]

View file

@ -1,15 +1,16 @@
using System.ComponentModel.DataAnnotations;
using Yavsc.Attributes.Validation;
namespace Yavsc.ViewModels.Account
{
public class ResetPasswordViewModel
{
[Required]
[YaRequired]
[EmailAddress]
public string Email { get; set; }
[Required]
[StringLength(100, ErrorMessage = "Le {0} doit être long d'au moins {2} caractères.", MinimumLength = 6)]
[YaRequired]
[YaStringLength(100, ErrorMessage = "Le {0} doit être long d'au moins {2} caractères.", MinimumLength = 6)]
[DataType(DataType.Password)]
public string Password { get; set; }

View file

@ -1,10 +1,11 @@
using System.ComponentModel.DataAnnotations;
using Yavsc.Attributes.Validation;
namespace Yavsc.ViewModels.Account
{
public class UnregisterViewModel
{
[Required]
[YaRequired]
public string UserId { get; set; }
public string ReturnUrl { get; set; }

View file

@ -1,13 +1,14 @@
using System.ComponentModel.DataAnnotations;
using Yavsc.Attributes.Validation;
namespace Yavsc.ViewModels.Account
{
public class VerifyCodeViewModel
{
[Required]
[YaRequired]
public string Provider { get; set; }
[Required]
[YaRequired]
public string Code { get; set; }
public string ReturnUrl { get; set; }

View file

@ -1,10 +1,11 @@
using System.ComponentModel.DataAnnotations;
using Yavsc.Attributes.Validation;
namespace Yavsc.ViewModels.Manage
{
public class AddPhoneNumberViewModel
{
[Required]
[YaRequired]
[Phone]
[Display(Name = "Phone number")]
public string PhoneNumber { get; set; }

View file

@ -1,16 +1,17 @@
using System.ComponentModel.DataAnnotations;
using Yavsc.Attributes.Validation;
namespace Yavsc.ViewModels.Manage
{
public class ChangePasswordViewModel
{
[Required]
[YaRequired]
[DataType(DataType.Password)]
[Display(Name = "Current password")]
public string OldPassword { get; set; }
[Required]
[StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
[YaRequired]
[YaStringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
[DataType(DataType.Password)]
[Display(Name = "New password")]
public string NewPassword { get; set; }

View file

@ -1,35 +1,36 @@
using System.ComponentModel.DataAnnotations;
using Yavsc.Attributes.Validation;
namespace Yavsc.ViewModels.Manage
{
public class DoDirectCreditViewModel {
[Required]
[YaRequired]
public string PaymentType  { get; set;}
[Required]
[YaRequired]
public string PayerName  { get; set;}
[Required]
[YaRequired]
public string FirstName  { get; set;}
[Required]
[YaRequired]
public string LastName  { get; set;}
[Required]
[YaRequired]
public string CreditCardNumber  { get; set;}
public string CreditCardType  { get; set;}
public string Cvv2Number  { get; set;}
public string CardExpiryDate  { get; set;}
public string IpnNotificationUrl { get; set; }
[Required]
[YaRequired]
public string Street1 { get; set; }
public string Street2 { get; set; }
public string City { get; set; }
public string State { get; set; }
public string Country { get; set; }
[Required]
[YaRequired]
public string PostalCode { get; set; }
public string Phone { get; set; }
[Required]
[YaRequired]
public string CurrencyCode { get; set; }
[Required]
[YaRequired]
public string Amount { get; set; }
}
}

View file

@ -1,16 +1,17 @@
using System.ComponentModel.DataAnnotations;
using Yavsc.Attributes.Validation;
namespace Yavsc.ViewModels.Manage
{
public class SetAddressViewModel
{
[Required]
[YaRequired]
public string Street1 { get; set; }
public string Street2 { get; set; }
public string City { get; set; }
public string State { get; set; }
public string Country { get; set; }
[Required]
[YaRequired]
public string PostalCode { get; set; }
}
}

View file

@ -1,11 +1,12 @@
using System.ComponentModel.DataAnnotations;
using Yavsc.Attributes.Validation;
namespace Yavsc.ViewModels.Manage
{
public class SetPasswordViewModel
{
[Required]
[StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
[YaRequired]
[YaStringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
[DataType(DataType.Password)]
[Display(Name = "New password")]
public string NewPassword { get; set; }

View file

@ -1,13 +1,14 @@
using System.ComponentModel.DataAnnotations;
using Yavsc.Attributes.Validation;
namespace Yavsc.ViewModels.Manage
{
public class VerifyPhoneNumberViewModel
{
[Required]
[YaRequired]
public string Code { get; set; }
[Required]
[YaRequired]
[Phone]
[Display(Name = "Phone number")]
public string PhoneNumber { get; set; }