system-praktyk-api/src/InternshipSystem.Core/Entity/Company.cs
maxchil 8514e593fa doroboty (#53)
XDDDEEEE

gtfo

Merge branch 'master' of http://git.kadet.net/system-praktyk/system-praktyk-api into doroboty

finaly

Co-authored-by: MaxchilKH <m.w.bohdanowicz@gmail.com>
2020-10-02 19:56:53 +02:00

39 lines
995 B
C#

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<BranchOffice> 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<Company>
{
public Validator()
{
RuleFor(x => x.Nip).NotNull();
RuleFor(x => x.Name).NotNull();
}
}
}
}