public Evento(Guid id, Engaze.Core.DataContract.Event eventoContract) : this() { var @event = new EventoCreated(id, eventoContract); RaiseEvent(@event); }
public EventoCreated(Guid aggregateId, Engaze.Core.DataContract.Event eventoContract) : base(aggregateId) { if (eventoContract == null) { throw new ArgumentNullException(nameof(eventoContract)); } this.Name = eventoContract.Name; this.EventType = eventoContract.EventType; this.Description = eventoContract.Description; this.InitiatorId = eventoContract.InitiatorId; this.InitiatorName = eventoContract.InitiatorName; this.StartTime = eventoContract.StartTime; this.EndTime = eventoContract.EndTime; if (eventoContract.Participants != null) { this.Participants = new List <Participant>(); eventoContract.Participants.ToList().ForEach(participant => this.Participants.Add(new Participant(participant.UserId, EventAcceptanceStatus.Pending))); } if (eventoContract.Destination != null) { this.Destination = JsonConvert.DeserializeObject <Location>(JsonConvert.SerializeObject(eventoContract.Destination)); } if (eventoContract.Duration != null) { this.Duration = JsonConvert.DeserializeObject <Duration>(JsonConvert.SerializeObject(eventoContract.Duration)); } if (eventoContract.Tracking != null) { this.Tracking = JsonConvert.DeserializeObject <Duration>(JsonConvert.SerializeObject(eventoContract.Tracking)); } if (eventoContract.Reminder != null) { this.Reminder = JsonConvert.DeserializeObject <Reminder>(JsonConvert.SerializeObject(eventoContract.Reminder)); } if (eventoContract.Recurrence != null) { this.Recurrence = JsonConvert.DeserializeObject <Recurrence>(JsonConvert.SerializeObject(eventoContract.Recurrence)); } this.EventState = eventoContract.EventState; }