public IActionResult TimeSpent(String id)
        {
            var task      = TodoProcessor.LoadTodo(id).Result;
            var timespent = new Models.Timespent();

            timespent.ID = task._id;
            return(View(timespent));
        }
Exemple #2
0
        static void Main(string[] args)
        {
            DependencyInjector pdi = new DependencyInjector();
            TodoProcessor      tdp = pdi.CreateAndInjectDependencies <TodoProcessor>().rootBean;

            tdp.Process();
            Thread.Sleep(5000);
            Console.Read();
        }
        public IActionResult UpdateTodo(String id)
        {
            var task = TodoProcessor.LoadTodo(id).Result;
            var todo = new Models.TodoModel();

            todo.ID       = task._id;
            todo.Title    = task.title;
            todo.Desc     = task.desc;
            todo.Estimate = task.estimate;
            return(View(todo));
        }
        public IActionResult Todo(String?id)
        {
            if (id == null)
            {
                Index();
            }

            var task = TodoProcessor.LoadTodo(id);

            return(View(task.Result));
        }
 public IActionResult NewTodo(Models.TodoModel todoModel)
 {
     if (ModelState.IsValid)
     {
         var todo = new TodoDataLibrary.PostTodo();
         todo.title    = todoModel.Title;
         todo.desc     = todoModel.Desc;
         todo.estimate = todoModel.Estimate;
         TodoProcessor.PostTodo(todo);
         return(RedirectToAction("Index"));
     }
     return(View());
 }
 public IActionResult UpdateTodo(Models.TodoModel todoModel)
 {
     if (ModelState.IsValid)
     {
         var todo = new TodoDataLibrary.TodoModel();
         todo._id      = todoModel.ID;
         todo.title    = todoModel.Title;
         todo.desc     = todoModel.Desc;
         todo.estimate = todoModel.Estimate;
         TodoProcessor.UpdateTodo(todo);
         return(RedirectToAction("Todo", "Home", new { id = todo._id }));
     }
     return(View());
 }
        public IActionResult TimeSpent(Models.Timespent timespentModel)
        {
            if (ModelState.IsValid)
            {
                var timespent = new TodoDataLibrary.Timespent();
                var todo      = new TodoDataLibrary.TodoModel();
                timespent.timespent = timespentModel.timespent;
                timespent.desc      = timespentModel.desc;
                todo._id            = timespentModel.ID;
                todo.timespent      = new List <TodoDataLibrary.Timespent>();
                todo.timespent.Add(timespent);

                TodoProcessor.TimeSpent(todo);
                return(RedirectToAction("Todo", "Home", new { id = timespentModel.ID }));
            }
            return(View());
        }
        public IActionResult DeleteTodo(String id)
        {
            TodoProcessor.DeleteTodo(id);

            return(RedirectToAction("Index", "Home"));
        }
        public IActionResult Index()
        {
            var task = TodoProcessor.LoadAllTodos();

            return(View(task.Result));
        }