36 lines
1007 B
C#
36 lines
1007 B
C#
using Core.Abstractions.Models;
|
|
using Core.Enumerations;
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
namespace WeatherForecast.Models.Account.Requests {
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public class PutPasswordChangeRequestModel : RequestModelBase, IValidatableObject {
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public string OldPassword { get; set; } = string.Empty;
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public string NewPassword { get; set; } = string.Empty;
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="validationContext"></param>
|
|
/// <returns></returns>
|
|
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext) {
|
|
if (string.IsNullOrWhiteSpace(OldPassword))
|
|
yield return new ValidationResult($"{nameof(OldPassword)} ${Errors.NullOrEmpty}");
|
|
|
|
if (string.IsNullOrWhiteSpace(NewPassword))
|
|
yield return new ValidationResult($"{nameof(NewPassword)} ${Errors.NullOrEmpty}");
|
|
}
|
|
}
|
|
}
|