Esempio n. 1
0
        public async Task <IActionResult> Index()
        {
            if (!User.Identity.IsAuthenticated)
            {
                return(RedirectToAction("UserLogin", "Login"));
            }

            var userId    = GetUserId();
            var toDoTasks = await _toDoListService.GetByUserId(userId);

            var result = toDoTasks.OrderBy(y => y.CreationDateTimeOffset).
                         Select(x => new ToDoTaskViewModel()
            {
                Id                         = x.Id,
                Description                = x.Description,
                IsChecked                  = x.IsChecked,
                CreationDateTimeOffset     = x.CreationDateTimeOffset,
                ModificationDateTimeOffset = x.ModificationDateTimeOffset
            });

            return(View(result));
        }