Exemplo n.º 1
0
        public async Task <IActionResult> Post([FromBody] PaymentPlanRequestObject PaymentPlanRequestObject)
        {
            var res = await _paymentPlanService.AddPaymentPlanAsync(PaymentPlanRequestObject);

            if (res == null)
            {
                return(BadRequest("Unable to create PaymentPlan at this time."));
            }

            return(CreatedAtRoute("GetPaymentPlan", new { id = res.Id }, res));
        }
        public async Task <PaymentPlanResponseObject> AddPaymentPlanAsync(PaymentPlanRequestObject paymentPlanRequestObject)
        {
            paymentPlanRequestObject.UpFrontRate = Math.Round(paymentPlanRequestObject.UpFrontRate, 2);
            var paymentPlan = _mapper.Map <PaymentPlan>(paymentPlanRequestObject);

            var result = await _paymentPlanRepo.AddPaymentPlanAsync(paymentPlan);

            if (result == null)
            {
                return(null);
            }

            return(_mapper.Map <PaymentPlanResponseObject>(result));
        }