31 lines
987 B
C#
31 lines
987 B
C#
using UniversityAllExpelled_Models.Exceptions;
|
|
using UniversityAllExpelled_Models.Extensions;
|
|
using UniversityAllExpelled_Models.Infrostructure;
|
|
|
|
namespace UniversityAllExpelled_Models.DataModels.Client;
|
|
|
|
public class PaymentLessonDataModel(string paymentId, string lessonId) : IValidation
|
|
{
|
|
public string PaymentId { get; private set; }
|
|
public string LessonId { get; private set; }
|
|
public void Validate()
|
|
{
|
|
if (PaymentId.IsEmpty())
|
|
{
|
|
throw new ValidationException("Field PaymentId is empty.");
|
|
}
|
|
if (!PaymentId.IsGuid())
|
|
{
|
|
throw new ValidationException("The value in the field PaymentId is not a valid GUID.");
|
|
}
|
|
if (LessonId.IsEmpty())
|
|
{
|
|
throw new ValidationException("Field LessonId is empty.");
|
|
}
|
|
if (!LessonId.IsGuid())
|
|
{
|
|
throw new ValidationException("The value in the field LessonId is not a valid GUID.");
|
|
}
|
|
}
|
|
}
|