示例#1
0
        public async Task <ActionResult> TogglePaymentType(int projectid, int paymentTypeId)
        {
            var project = await ProjectRepository.GetProjectAsync(projectid);

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

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

            try
            {
                if (paymentTypeId < 0)
                {
                    await FinanceService.CreateCashPaymentType(projectid, CurrentUserId, -paymentTypeId);
                }
                else
                {
                    await FinanceService.TogglePaymentActivness(projectid, CurrentUserId, paymentTypeId);
                }
                return(RedirectToAction("Setup", new { projectid }));
            }
            catch
            {
                //TODO: Message that comment is not added
                return(RedirectToAction("Setup", new { projectid }));
            }
        }
示例#2
0
        public async Task <ActionResult> TogglePaymentType(int projectid, int paymentTypeId)
        {
            var project = await ProjectRepository.GetProjectAsync(projectid);

            try
            {
                if (paymentTypeId < 0)
                {
                    await FinanceService.CreateCashPaymentType(projectid, -paymentTypeId);
                }
                else
                {
                    await FinanceService.TogglePaymentActivness(projectid, paymentTypeId);
                }
                return(RedirectToAction("Setup", new { projectid }));
            }
            catch
            {
                //TODO: Message that comment is not added
                return(RedirectToAction("Setup", new { projectid }));
            }
        }