Exemple #1
0
        public async Task <IActionResult> Completed()
        {
            Guid userId = new Guid(_userManager.GetUserId(User));
            CompletedViewModel completed = new CompletedViewModel();
            List <TodoItem>    items     = await _repository.GetCompletedAsync(userId);

            foreach (var item in items)
            {
                TodoViewModel model = new TodoViewModel(item.Id, item.Text, item.DateCompleted, item.IsCompleted);
                completed.Add(model);
            }
            return(View(completed));
        }
Exemple #2
0
        public IActionResult Completed()
        {
            Guid userId = new Guid(_userManager.GetUserId(User));
            CompletedViewModel models = new CompletedViewModel();
            List <TodoItem>    items  = _repository.GetCompleted(userId).OrderByDescending(i => i.DateCompleted).ToList();

            foreach (TodoItem item in items)
            {
                TodoViewModel model = new TodoViewModel(item.Id, item.Text, item.DateCompleted, item.IsCompleted);
                model.Labels = TodoViewModel.GetLabelsRaw(item.Labels);
                models.Add(model);
            }
            return(View(models));
        }