Exemplo n.º 1
0
        public async Task <IActionResult> Index([FromRoute] int projectId, string searchString)
        {
            var todos = await _todoRepository.AllTodosByProjectId(projectId).ConfigureAwait(true);

            var project = await _todoRepository.GetProjectById(projectId).ConfigureAwait(true);

            if (!string.IsNullOrEmpty(searchString))
            {
                searchString.ToLower();

                todos = todos.Where(t => t.Name.ToLower().Contains(searchString)).ToList();
            }

            var model = new TodoListViewModel
            {
                Todos   = todos,
                Project = project
            };

            return(View(model));
        }