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