25 lines
841 B
C#
25 lines
841 B
C#
using System;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using UniversityAllExpelled_Models.Extensions;
|
|
using UniversityAllExpelled_Models.Infrostructure;
|
|
|
|
namespace UniversityAllExpelled_Models.DataModels.Worker;
|
|
|
|
public class SalaryDataModel(string id, double count, DateTime date) : IValidation
|
|
{
|
|
public string Id { get; private set; } = id;
|
|
public double Count { get; private set; } = count;
|
|
public DateTime Date { get; private set; } = date;
|
|
|
|
public void Validate()
|
|
{
|
|
if (Id.IsEmpty())
|
|
throw new ValidationException("Salary record ID cannot be empty");
|
|
|
|
if (!Id.IsGuid())
|
|
throw new ValidationException("Salary record ID must be in valid GUID format");
|
|
|
|
if (Count <= 0)
|
|
throw new ValidationException("Salary amount must be greater than zero");
|
|
}
|
|
} |