public async Task <IActionResult> Details(int?id)
 {
     if (id.HasValue)
     {
         HomeController hc = new HomeController();
         return(View(TaskViewModel.GetDetails(id.Value, await hc.APIListGet(), await APItodoGetOne(id.Value))));
     }
     return(RedirectToAction("Index"));
 }
        public async Task <IActionResult> Delete(int id)
        {
            HomeController hc  = new HomeController();
            TaskViewModel  tvm = TaskViewModel.GetDetails(id, await hc.APIListGet(), await APItodoGetOne(id));

            if (tvm.ToDo == null)
            {
                return(NotFound());
            }
            await APItodoDelete(id);

            return(RedirectToAction("Index"));
        }
        public async Task <IActionResult> Update(int id, [Bind("ID,Name,IsDone,ToDoList")] ToDoItem toDo)
        {
            HomeController hc      = new HomeController();
            ListsViewModel lvm     = ListsViewModel.GetLists(id, await hc.APIListGet());
            ToDoList       getList = lvm.ToDoLists.FirstOrDefault(i => i.Name == toDo.ToDoList);

            toDo.ListID = getList.ID;

            if (ModelState.IsValid)
            {
                toDo.ID = id;
                await APITaskPut(toDo.ID, toDo);

                return(RedirectToAction("Index", "ToDo"));
            }
            return(View(TaskViewModel.GetDetails(id, await hc.APIListGet(), await APItodoGetOne(id))));
        }