コード例 #1
0
 public static PaymentGateway MapToDbEntity(PaymentGatewayDto paymentGateway)
 {
     return(new PaymentGateway()
     {
         PaymentGatewayId = paymentGateway.PaymentGatewayId,
         GatewayName = paymentGateway.GatewayName,
         IsActive = paymentGateway.IsActive
     });
 }
コード例 #2
0
        public void Post_ReturnsNOK()
        {
            var controller = new PaymentGatewayController(pgm);
            // Act
            PaymentGatewayDto pgdo = new PaymentGatewayDto();
            var result             = controller.Post(pgdo);

            // Assert
            Assert.IsType <BadRequestResult>(result);
        }
コード例 #3
0
        public PaymentGatewayDto SavePaymentGateway(PaymentGatewayDto paymentGateway)
        {
            var newPaymentGateway = MapToDbEntity(paymentGateway);

            _dbContext.PaymentGateway.Add(newPaymentGateway);
            if (_dbContext.SaveChanges() != 0)
            {
                return(MapToDto(newPaymentGateway));
            }
            return(null);
        }
コード例 #4
0
 public IActionResult Post([FromBody] PaymentGatewayDto paymentGateway)
 {
     try
     {
         if (ModelState.IsValid)
         {
             var result = _paymentGatewayManipulation.SavePaymentGateway(paymentGateway);
             if (result != null)
             {
                 return(Ok(result));
             }
         }
         else
         {
             return(BadRequest(paymentGateway));
         }
     }
     catch (Exception e)
     {
     }
     return(BadRequest());
 }
コード例 #5
0
 public PaymentGatewayDto SavePaymentGateway(PaymentGatewayDto paymentGateway)
 {
     return(_paymentGatewayRepository.SavePaymentGateway(paymentGateway));
 }