2025-02-26 14:36:59 +03:00

36 lines
1014 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using WingsOfTheWorldContratcs.Exceptions;
using WingsOfTheWorldContratcs.Exstensions;
using WingsOfTheWorldContratcs.Infrastructure;
namespace WingsOfTheWorldContratcs.DataModels;
public class AirplaneDataModel(string id, string model) : IValidation
{
public string Id { get; private set; } = id;
public string Model { get; private set; } = model;
public void Validate()
{
if (Id.IsEmpty())
throw new ValidationException("Field Id is empty");
if (!Id.IsGuid())
throw new ValidationException("The value in the field Id is not a unique identifier");
if (Model.IsEmpty())
throw new ValidationException("Field Model is empty");
if (!Model.IsGuid())
throw new ValidationException("The value in the field Model is not a unique identifier");
}
}