using System; using System.Collections.Generic; using FluentValidation; using FluentValidation.Validators; namespace InternshipSystem.Core { public class Company { public long Id { get; set; } public string Nip { get; set; } public string Name { get; set; } public List Branches { get; set; } public long Provider { get; set; } public static Company CreateCompany(string nip, string name, long provider = 0) => new Company { Nip = nip, Name = name, Provider = provider }; public void AddBranchOffice(BranchOffice createBranch) { Branches.Add(createBranch); } public class Validator : AbstractValidator { public Validator() { RuleFor(x => x.Nip).NotNull(); RuleFor(x => x.Name).NotNull(); } } } }