예제 #1
0
        public async Task <IActionResult> Add(TaskAddViewModel vm)
        {
            if (ModelState.IsValid)
            {
                TaskType type = await taskTypeRepository.GetById(vm.type);

                User reporter = await userManager.GetUserAsync(HttpContext.User);

                User assignee = await userManager.FindByIdAsync(vm.assignee);

                Task task = new Task();
                task.name        = vm.name;
                task.description = vm.description;
                task.type        = type;
                task.reporter    = reporter;
                task.assignee    = assignee;
                task.state       = vm.state;

                await taskRepository.Add(task);

                return(RedirectToAction("Index", "Kanban"));
            }

            return(View(vm));
        }
예제 #2
0
 public IActionResult Add(TaskAddViewModel model)
 {
     if (_manager.CreateTask(CurrentUser(), model.Description))
     {
         return(RedirectToAction(nameof(Index)));
     }
     else
     {
         return(View(model));
     }
 }
예제 #3
0
        private void ucTaskAdd_Load(object sender, EventArgs e)
        {
            if (DesignMode)
            {
                return;
            }

            Init();
            m_viewModel = new TaskAddViewModel();
            dataGridViewX1.DataSource = m_viewModel.TaskList;
        }
예제 #4
0
 public IActionResult AddTask(TaskAddViewModel model)
 {
     if (ModelState.IsValid)
     {
         _taskService.Save(new Task
         {
             Description = model.Description,
             Name        = model.Name,
             PriorityId  = model.PriorityId
         });
         return(RedirectToAction("Index"));
     }
     return(View(model));
 }
 public IActionResult AddTask(TaskAddViewModel model)
 {
     TempData["Active"] = "task";
     if (ModelState.IsValid)
     {
         _taskService.Save(new Task
         {
             Description = model.Description,
             Name        = model.Name,
             UrgencyId   = model.UrgencyId,
         });
         return(RedirectToAction("Index"));
     }
     return(View(model));
 }
예제 #6
0
 public TaskEditPage(TaskDTO item)
 {
     try
     {
         InitializeComponent();
         if (item != null)
         {
             BindingContext = new TaskEditViewModel(item, Navigation);
         }
         else
         {
             BindingContext = new TaskAddViewModel(Navigation);
         }
     }
     catch (Exception e)
     {
         Debug.WriteLine(e);
         throw e;
     }
 }
예제 #7
0
        public IActionResult Add()
        {
            var model = new TaskAddViewModel();

            return(View(model));
        }