forked from slavaxom9k/PIBD-23_Fomichev_V.S._MagicCarpet
33 lines
1.2 KiB
C#
33 lines
1.2 KiB
C#
using MagicCarpetContracts.Exceptions;
|
|
using MagicCarpetContracts.Extensions;
|
|
using MagicCarpetContracts.Infrastructure;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace MagicCarpetContracts.DataModels;
|
|
|
|
public class TourSuppliesDataModel(string suppliesId, string tourId, int count) : IValidation
|
|
{
|
|
public string SuppliesId { get; private set; } = suppliesId;
|
|
public string TourId { get; private set; } = tourId;
|
|
public int Count { get; private set; } = count;
|
|
|
|
public void Validate()
|
|
{
|
|
if (SuppliesId.IsEmpty())
|
|
throw new ValidationException("Field SuppliesId is empty");
|
|
if (!SuppliesId.IsGuid())
|
|
throw new ValidationException("The value in the field SuppliesId is not a unique identifier");
|
|
if (TourId.IsEmpty())
|
|
throw new ValidationException("Field TourId is empty");
|
|
if (!TourId.IsGuid())
|
|
throw new ValidationException("The value in the field BlandId is not a unique identifier");
|
|
if (Count <= 0)
|
|
throw new ValidationException("Field Count is less than or equal to 0");
|
|
}
|
|
}
|