Files
Course/ClassLibrary1/Article.cs
2025-06-07 17:57:26 +04:00

29 lines
905 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ClassLibrary1
{
public class Article(string id, string title, string tema, DateTime dateCreat) : IValidation
{
public string Id { get; set; } = id;
public string Title { get; set; } = title;
public string Tema { get; set; } = tema;
public DateTime DateCreat { get; set; } = dateCreat;
public void Validate()
{
if (Id.IsEmpty())
throw new ValidationException("Field Id is empty");
if (!Id.IsGuid())
throw new ValidationException("Id is Guid");
if (Title.IsEmpty())
throw new ValidationException("Field Id is empty");
if (Tema.IsEmpty())
throw new ValidationException("Field Id is empty");
}
}
}