public void When(ProposalSubmitted proposalSubmitted) { Id = Id.FromExisting(proposalSubmitted.ProposalId); Client = Client.From(proposalSubmitted.ClientId); Expectations = Proposals.Expectations.Of( Summary.Has(proposalSubmitted.Summary), Description.Has(proposalSubmitted.Description), new DateTime(proposalSubmitted.CompletedBy), Expectations.Convert(proposalSubmitted.Steps), proposalSubmitted.Price, proposalSubmitted.Keywords.Split(",").ToHashSet()); this.Progress = Progress.NONE; }
public static ProposalSubmitted Instance( Id proposalId, Client client, Expectations expectations) { ProposalSubmitted proposalSubmitted = new ProposalSubmitted { ProposalId = proposalId.Value, ClientId = client.Id.Value, Summary = expectations.Summary.Text, Description = expectations.Description.Text, CompletedBy = expectations.CompletedBy.Ticks, Steps = Expectations.Convert(expectations.Steps), Price = expectations.Price, Keywords = string.Join(",", expectations.Keywords) }; return(proposalSubmitted); }
private Proposal(Id id, Client client, Expectations expectations, Progress progress) { Apply(ProposalSubmitted.Instance(id, client, expectations)); }