/// <summary> /// Initializes a new <see cref="TodoListItemViewModel"/> instance. /// </summary> /// <param name="todoListItem">The model from which the view model is to be generated.</param> public TodoListItemViewModel(TodoListItem todoListItem) { this.Id = todoListItem.Id; this.Title.Value = todoListItem.Title; this.Description.Value = todoListItem.Description; this.IsFinished.Value = todoListItem.IsFinished; }
/// <summary> /// Adds a new item to the todo list. /// </summary> /// <param name="title">The title of the new todo list item.</param> /// <param name="description">The description of the new todo list item.</param> /// <returns>Returns the created todo list item.</returns> public TodoListItem CreateTodoListItem(string title, string description) { TodoListItem todoListItem = new TodoListItem { Title = title, Description = description }; TodoListItemsRepository.todoListItems.Add(todoListItem); return todoListItem; }