예제 #1
0
 public IActionResult CreateTaskBoard(TeamTaskBoardViewModel teamTaskBoardViewModel, string page)
 {
     if (page == "project")
     {
         var taskBoardViewModel = teamTaskBoardViewModel.TaskBoardViewModel;
         var dbTaskBoard        = _mapper.Map <DbTaskBoard>(taskBoardViewModel);
         _repository.Create(dbTaskBoard);
         _repository.Save();
         return(RedirectToAction("Project", "Projects", new { projectId = taskBoardViewModel.ProjectId }));
     }
     else
     {
         var taskBoardViewModel = teamTaskBoardViewModel.TaskBoardViewModel;
         var dbTaskBoard        = _mapper.Map <DbTaskBoard>(taskBoardViewModel);
         _repository.Create(dbTaskBoard);
         _repository.Save();
         return(RedirectToAction("Team", "Teams", new { taskBoardViewModel.TeamId, projId = taskBoardViewModel.ProjectId }));
     }
 }
        public async Task <TaskBoardViewModel> Handle(CreateTaskBoardCommand request, CancellationToken cancellationToken)
        {
            var taskBoard = new TaskBoard
                            (
                request.Name,
                request.Position
                            );

            _taskBoardRepository.Create(taskBoard);

            await _taskBoardRepository.UnitOfWork.SaveChangesAsync(cancellationToken);

            var viewModel = new TaskBoardViewModel
            {
                Id   = taskBoard.Id,
                Name = taskBoard.Name
            };

            return(viewModel);
        }