public static TodoListAggregate Create(Guid listId, string name) { var list = new TodoListAggregate() { ListId = listId, Name = name ?? "<no_name>" }; list.RaiseEvent(new TodoListCreatedEvent(listId, name)); return(list); }
public static TodoListAggregate From(TodoListDto dto, IEnumerable <TodoListItemDto> dtos) { var model = new TodoListAggregate() { Key = dto.Id, ListId = dto.ListId, Name = dto.Name, }; model._items.AddRange(dtos.Select(TodoItem.Map.From)); return(model); }