Пример #1
0
        public async Task <ActionResult> Create(AddPlotFolderViewModel viewModel)
        {
            try
            {
                await _plotService.CreatePlotFolder(viewModel.ProjectId, viewModel.PlotFolderTitleAndTags, viewModel.TodoField);

                return(RedirectToAction("Index", "Plot", new { viewModel.ProjectId }));
            }
            catch (Exception exception)
            {
                ModelState.AddException(exception);
                return(View(viewModel));
            }
        }
Пример #2
0
        public async Task <ActionResult> Create(AddPlotFolderViewModel viewModel)
        {
            var project = await ProjectRepository.GetProjectAsync(viewModel.ProjectId);

            var errorResult = AsMaster(project, acl => acl.CanManagePlots);

            if (errorResult != null)
            {
                return(errorResult);
            }

            try
            {
                await _plotService.CreatePlotFolder(project.ProjectId, CurrentUserId, viewModel.PlotFolderMasterTitle, viewModel.TodoField);

                return(RedirectToAction("Index", "Plot", new { project.ProjectId }));
            }
            catch (Exception)
            {
                return(View(viewModel));
            }
        }