public void CompleteItem(Guid guid, TodoList todoList) { if (todoList == null) { throw new ArgumentNullException("todoList"); } var result = todoList.Items.SingleOrDefault(x => x.Id == guid); if (result == null) { throw new ArgumentException("Item does not exist in list."); } if (result.IsCompleted) { throw new ArgumentException("Item is already completed."); } result.IsCompleted = true; _notificationManager.NotifyOfCompletedTask(result.Name); }
public Guid AddItem(string name, TodoList todoList) { if (name == null) { throw new ArgumentNullException("name"); } if (todoList == null) { throw new ArgumentNullException("todoList"); } var item = new TodoItem { Id = Guid.NewGuid(), IsCompleted = false, Name = name }; todoList.Items.Add(item); return(item.Id); }