Esempio n. 1
0
        public async Task <ActionResult> CreatePaymentType(CreatePaymentTypeViewModel viewModel)
        {
            try
            {
                await FinanceService.CreateCustomPaymentType(viewModel.ProjectId, viewModel.Name, viewModel.UserId);

                return(RedirectToAction("Setup", new { viewModel.ProjectId }));
            }
            catch
            {
                //TODO: Message that comment is not added
                return(RedirectToAction("Setup", new { viewModel.ProjectId }));
            }
        }
Esempio n. 2
0
        public async Task <ActionResult> CreatePaymentType(CreatePaymentTypeViewModel viewModel)
        {
            var project = await ProjectRepository.GetProjectAsync(viewModel.ProjectId);

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

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

            try
            {
                await FinanceService.CreateCustomPaymentType(viewModel.ProjectId, CurrentUserId, viewModel.Name, viewModel.UserId);

                return(RedirectToAction("Setup", new { viewModel.ProjectId }));
            }
            catch
            {
                //TODO: Message that comment is not added
                return(RedirectToAction("Setup", new { viewModel.ProjectId }));
            }
        }