// GET api/<TodoListController>/5 public async Task <IActionResult> Get(int id, [FromQuery] string search, [FromQuery] bool undone) { var todoList = await this.db.TodoLists.Include(a => a.Items) .SingleOrDefaultAsync(a => a.Id == id); if (todoList == null) { return(NotFound()); } var todoItemVM = todoList.Items.Where(item => (string.IsNullOrWhiteSpace(search) || item.Name.ToLower() .Contains(search .ToLower())) && (!undone || !item.Completed)) .Select(a => new TodoItemVM() { Id = a.Id, Name = a.Name, CompletedTask = a.Completed, CreateDate = a.CreateDate }).ToList(); var todoListVM = new TodoListVM() { Id = todoList.Id, Name = todoList.Name, Items = todoItemVM }; return(Ok(todoListVM)); }
public NewTodoP(TodoListVM todoListVM) { InitializeComponent(); TodoListVM = todoListVM; Todo = new Todo { Id = Guid.NewGuid().ToString(), Title = "Item name", Description = "This is an item description." }; BindingContext = this; }
public TodoListP() { InitializeComponent(); var todoList = new TodoList { Title = "Title", Todos = new List <Todo>() { new Todo { Id = Guid.NewGuid().ToString(), Title = "TODOLIST 1 First item", Description = "This is an item description." }, } }; BindingContext = TodoListVM = new TodoListVM(todoList); }
public TodoListP(TodoListVM viewModel) { InitializeComponent(); BindingContext = this.TodoListVM = viewModel; }