Ejemplo n.º 1
0
 public async Task <ActionResult> TogglePaymentType(TogglePaymentTypeViewModel data)
 {
     try
     {
         if (data.PaymentTypeId > 0)
         {
             await FinanceService.TogglePaymentActiveness(data.ProjectId, data.PaymentTypeId.Value);
         }
         else
         {
             await FinanceService.CreatePaymentType(new CreatePaymentTypeRequest
             {
                 ProjectId      = data.ProjectId,
                 TargetMasterId = data.MasterId,
                 TypeKind       = (PaymentTypeKind)data.TypeKind.GetValueOrDefault(PaymentTypeKindViewModel.Custom),
             });
         }
         return(RedirectToAction("Setup", new { projectid = data.ProjectId }));
     }
     catch
     {
         //TODO: Message that payment type was not created
         return(RedirectToAction("Setup", new { projectid = data.ProjectId }));
     }
 }
Ejemplo n.º 2
0
        public async Task <ActionResult> CreatePaymentType(CreatePaymentTypeViewModel viewModel)
        {
            try
            {
                await FinanceService.CreatePaymentType(new CreatePaymentTypeRequest
                {
                    ProjectId      = viewModel.ProjectId,
                    TargetMasterId = viewModel.UserId,
                    TypeKind       = PaymentTypeKind.Custom,
                    Name           = viewModel.Name,
                });

                return(RedirectToAction("Setup", new { viewModel.ProjectId }));
            }
            catch
            {
                //TODO: Message that comment is not added
                return(RedirectToAction("Setup", new { viewModel.ProjectId }));
            }
        }
Ejemplo n.º 3
0
        public async Task <ActionResult> CreatePaymentType(CreatePaymentTypeViewModel viewModel)
        {
            try
            {
                await FinanceService.CreatePaymentType(new CreatePaymentTypeRequest
                {
                    ProjectId      = viewModel.ProjectId,
                    TargetMasterId = viewModel.UserId,
                    TypeKind       = PaymentTypeKind.Custom,
                    Name           = viewModel.Name,
                });

                return(RedirectToAction("Setup", new { viewModel.ProjectId }));
            }
            catch (Exception ex)
            {
                logger.LogError(ex, "Проблема при создании платежа");
                //TODO: Message that comment is not added
                return(RedirectToAction("Setup", new { viewModel.ProjectId }));
            }
        }