private void OnScheduleNewTask(object sender, RoutedEventArgs e) { var command = new ScheduleNewTask { Id = new TaskId(Guid.NewGuid()), TaskName = TaskName.Text, DueDateTime = DueDate.SelectedDate.GetValueOrDefault(), Instructions = Instructions.Text, CandidateIds = Candidates.Select(x => x.Id).ToArray(), AnimalIds = Animals.Select(x => x.Id).ToArray() }; Bus.Send(command, result => OnNewTask(null, null)); }
public void When(ScheduleNewTask c) { if (state.Version > 0) throw new Exception("Cannot create the same aggregate twice."); var e = new NewTaskScheduled { Id = c.Id, TaskName = c.TaskName, Instructions = c.Instructions, DueDateTime = c.DueDateTime, CandidateIds = c.CandidateIds, AnimalIds = c.AnimalIds }; Apply(e); }