Пример #1
0
        public IActionResult Create(int userId)
        {
            Task t = new Task(userId);

            t.UserId = userId;
            return(View(t));
        }
Пример #2
0
        public IActionResult Edit([Bind("Id,Description, State, UserId")] Task task)
        {
            if (ModelState.IsValid)
            {
                _api.UpdateTask(task.UserId, task);
                return(RedirectToAction("Index", "Tasks", new { userId = task.UserId }));
            }

            return(View(task));
        }
Пример #3
0
        public IActionResult DeleteConfirmed(int userId, int id)
        {
            if (_api.DeleteTask(userId, id))
            {
                return(RedirectToAction("Index", "Tasks", new { userId = userId }));
            }

            Task t = _api.GetTaskById(userId, id);

            ModelState.AddModelError(string.Empty, "Task couldn't be deleted");
            return(View(t));
        }
Пример #4
0
        public IActionResult Edit(int userId, int id)
        {
            Task t = _api.GetTaskById(userId, id);

            return(View(t));
        }