예제 #1
0
        public async Task <IActionResult> Create(int orderId, [FromBody] ProcessPaymentInputModel processPaymentInputModel)
        {
            var result = await _paymentService.Process(processPaymentInputModel);

            if (!result.Success)
            {
                return(BadRequest(result.Errors));
            }

            return(CreatedAtAction(nameof(GetPayment), new { orderId, id = result.IdPayment }, result));
        }
예제 #2
0
        public IActionResult Create([FromBody] ProcessPaymentInputModel processPaymentInputModel)
        {
            var randomId = new Random().Next(1, 3);

            return(CreatedAtAction(nameof(Get), new { id = randomId }, new ProcessPaymentResultViewModel(randomId, true, new List <string>())));
        }