public static PaymentGateway MapToDbEntity(PaymentGatewayDto paymentGateway) { return(new PaymentGateway() { PaymentGatewayId = paymentGateway.PaymentGatewayId, GatewayName = paymentGateway.GatewayName, IsActive = paymentGateway.IsActive }); }
public void Post_ReturnsNOK() { var controller = new PaymentGatewayController(pgm); // Act PaymentGatewayDto pgdo = new PaymentGatewayDto(); var result = controller.Post(pgdo); // Assert Assert.IsType <BadRequestResult>(result); }
public PaymentGatewayDto SavePaymentGateway(PaymentGatewayDto paymentGateway) { var newPaymentGateway = MapToDbEntity(paymentGateway); _dbContext.PaymentGateway.Add(newPaymentGateway); if (_dbContext.SaveChanges() != 0) { return(MapToDto(newPaymentGateway)); } return(null); }
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()); }
public PaymentGatewayDto SavePaymentGateway(PaymentGatewayDto paymentGateway) { return(_paymentGatewayRepository.SavePaymentGateway(paymentGateway)); }