resolve nip and phoneNumber problem

This commit is contained in:
mborzyszkowski 2020-08-04 19:58:25 +02:00
parent b9010f5134
commit d3682416b8
5 changed files with 4 additions and 52 deletions

View File

@ -6,13 +6,13 @@ namespace InternshipSystem.Core
public class Company public class Company
{ {
public long Id { get; set; } public long Id { get; set; }
public Nip Nip { get; set; } public string Nip { get; set; }
public string Name { get; set; } public string Name { get; set; }
public RangeOfActivity Range { get; set; } public RangeOfActivity Range { get; set; }
public List<BranchOffice> Branches { get; set; } public List<BranchOffice> Branches { get; set; }
public Uri SiteAddress { get; set; } public Uri SiteAddress { get; set; }
public Company CreateCompany(Nip nip, RangeOfActivity range, string name) public Company CreateCompany(string nip, RangeOfActivity range, string name)
{ {
return new Company return new Company
{ {

View File

@ -5,6 +5,6 @@
public string FirstName { get; set; } public string FirstName { get; set; }
public string LastName { get; set; } public string LastName { get; set; }
public string Email { get; set; } public string Email { get; set; }
public PhoneNumber PhoneNumber { get; set; } public string PhoneNumber { get; set; }
} }
} }

View File

@ -1,22 +0,0 @@
namespace InternshipSystem.Core
{
public class Nip
{
private readonly string nip;
public Nip()
{
}
private Nip(string maybeNip)
{
nip = maybeNip;
}
public static implicit operator string(Nip nip) =>
nip.nip;
public static implicit operator Nip(string maybeNip) =>
new Nip(maybeNip);
}
}

View File

@ -1,22 +0,0 @@
namespace InternshipSystem.Core
{
public class PhoneNumber
{
private readonly string phoneNumber;
public PhoneNumber()
{
}
private PhoneNumber(string maybePhoneNumber)
{
phoneNumber = maybePhoneNumber;
}
public static implicit operator string(PhoneNumber phoneNumber) =>
phoneNumber.phoneNumber;
public static implicit operator PhoneNumber(string maybephoneNumber) =>
new PhoneNumber(maybephoneNumber);
}
}

View File

@ -25,11 +25,7 @@ namespace InternshipSystem.Repository
.OwnsOne(bo => bo.Address); .OwnsOne(bo => bo.Address);
modelBuilder.Entity<InternshipProgram>() modelBuilder.Entity<InternshipProgram>()
.OwnsOne(ip => ip.Mentor) .OwnsOne(ip => ip.Mentor);
.OwnsOne(m => m.PhoneNumber);
modelBuilder.Entity<Company>()
.OwnsOne(c => c.Nip);
modelBuilder.Entity<ProgramSubject>(builder => modelBuilder.Entity<ProgramSubject>(builder =>
{ {