Last active
June 26, 2021 13:38
-
-
Save maiconheck/a495da31a9fa2fd7192823a87a60a579 to your computer and use it in GitHub Desktop.
Capturar Leads Context
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
namespace DddBuildingBlocks.Domain.CapturarLeadsContext | |
{ | |
public class Lead : Entity | |
{ | |
private readonly List<Segment> _segments = new List<Segment>(); | |
public Lead(Email email) | |
{ | |
Email = email; | |
} | |
public Name Name { get; private set; } | |
public Email Email { get; private set; } | |
public PhoneNumber PhoneNumber { get; private set; } | |
public Address Address { get; private set; } | |
public Gender? Gender { get; private set; } | |
public DateTime? BirthDate { get; private set; } | |
public string Company { get; private set; } | |
public IReadOnlyCollection<Segment> Segments => _segments.ToList(); | |
public void AddSegment(IEnumerable<Segment> segment) => _segments.AddRange(segment); | |
public void Update(PhoneNumber phoneNumber) => PhoneNumber = phoneNumber; | |
public void Update(Address address) => Address = address; | |
public void Update(Gender? gender) => Gender = gender; | |
public void Update(DateTime? birthDate) => BirthDate = birthDate; | |
public void Update( | |
Name name, | |
Email email, | |
PhoneNumber phoneNumber, | |
Address address, | |
Gender gender, | |
DateTime birthDate) | |
{ | |
Name = name; | |
Email = email; | |
PhoneNumber = phoneNumber; | |
Address = address; | |
Gender = gender; | |
BirthDate = birthDate; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment