namespace xxx.Models
{
// Centralised validation rules for LoanAmount
// Kept as a static class to avoid introducing DI/config complexity for a take-home
public static class PayAmountRules
{
public const decimal Min = 1_000m;
public const decimal Max = 2_000_000m;
public static bool IsValid(decimal value) => value >= Min && value <= Max;
}
}
using System.ComponentModel.DataAnnotations;
namespace xxx.Models
{
public sealed class Application
{
public Guid Id { get; set; }
[Required]
[MaxLength(100)]
public string ApplicantName { get; set; } = string.Empty;
[Required]
public decimal Amount{ get; set; }
public DateTimeOffset CreatedOn { get; set; }
public ApplicationStatus Status { get; set; } = ApplicationStatus.Submitted;
}
}
using System.ComponentModel.DataAnnotations;
namespace xxx.DTOs
{
public sealed class CreateApplicationRequest
{
[Required]
[MinLength(2)]
[MaxLength(100)]
public string ApplicantName { get; init; } = string.Empty;
public decimal Amount { get; init; }
}
}
namespace xxx.Models
{
// Centralised validation rules for LoanAmount
// Kept as a static class to avoid introducing DI/config complexity for a take-home
public static class PayAmountRules
{
public const decimal Min = 1_000m;
public const decimal Max = 2_000_000m;
public static bool IsValid(decimal value) => value >= Min && value <= Max;
}
}
using System.ComponentModel.DataAnnotations;
namespace xxx.Models
{
public sealed class Application
{
public Guid Id { get; set; }
[Required]
[MaxLength(100)]
public string ApplicantName { get; set; } = string.Empty;
[Required]
public decimal Amount{ get; set; }
public DateTimeOffset CreatedOn { get; set; }
public ApplicationStatus Status { get; set; } = ApplicationStatus.Submitted;
}
}
using System.ComponentModel.DataAnnotations;
namespace xxx.DTOs
{
public sealed class CreateApplicationRequest
{
[Required]
[MinLength(2)]
[MaxLength(100)]
public string ApplicantName { get; init; } = string.Empty;
public decimal Amount { get; init; }
}
}