public void AddTodo(string title, string description, DateTime?dueDate = null, int?subListId = null) { if (subListId.HasValue) { var subList = SubLists.SingleOrDefault(sublist => sublist.Id == subListId.Value); if (subList == null) { // TODO: Add custom exceptions throw new Exception(); } subList.AddTodo(title, description, dueDate); } else { var todo = new TodoItem(title, description, dueDate); _items.Add(todo); } }
public async Task ChooseSongsAsync() { if (SubLists.Count == 0) { throw new BasicBlankException("Can't have 0 songs. Otherwise, rethinking is required"); } int actuallyChosen = await _logic.ChooseSongsAsync(SubLists.First(), Percentage, HowManySongsWanted); SongsActuallyChosen += actuallyChosen; SubLists.RemoveFirstItem(); if (SubLists.Count == 0) { await _logic.CreatePlaylistSongsAsync(); var model = new StartPlayingPlayListEventModel(); await Aggregator !.PublishAsync(model); return; } ClearSelections(); FocusOnFirst(); }