示例#1
0
 private Bet(BetId betId, DateTime endDate, int coins, Member creator, string description, DateTime creationDate)
 {
     _creationDate = creationDate;
     _betId        = betId;
     _endDate      = new EndDate(endDate, _creationDate);
     _coins        = coins;
     _creator      = creator;
     _description  = description;
     _answers      = new Dictionary <Member, Answer>();
     _status       = new BetOpenStatus();
     AddDomainEvent(new BetCreated(betId, _creator.Id));
 }
示例#2
0
 private Bet(BetState state)
 {
     _betId        = new BetId(state.BetId);
     _endDate      = new EndDate(state.EndDate);
     _coins        = state.Coins;
     _creator      = state.Creator;
     _description  = state.Description;
     _creationDate = state.CreationDate;
     _answers      = new Dictionary <Member, Answer>(
         state.Answers?.Select(x =>
                               new KeyValuePair <Member, Answer>(
                                   x.Member,
                                   new Answer(x.IsAccepted, x.DateAnswer)
                                   )
                               ));
     _isSuccess = state.IsSuccess;
     _closeDate = state.CloseDate;
     _status    = state.Status;
 }