public async Task <IActionResult> AddPost([FromBody] PaymentDetail model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    var pmId = await _paymentRepository.AddPaymentDetail(model);

                    if (pmId > 0)
                    {
                        return(Ok(pmId));
                    }
                    else
                    {
                        return(NotFound());
                    }
                }
                catch (Exception)
                {
                    return(BadRequest());
                }
            }

            return(BadRequest());
        }
 public ActionResult AddUser(PaymentDetail _paymentDetail)
 {
     try
     {
         int VarpaymentID = _paymentRepository.AddPaymentDetail(_mapper.Map <Demo.Core.Data.Model.PaymentDetail>(_paymentDetail));
         return(VarpaymentID == 0 ? NotFound(VarpaymentID) : (ActionResult)Ok(200));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Beispiel #3
0
        public void AddPayment()
        {
            PaymentDetail _payment = new PaymentDetail
            {
                CardOwnerName  = "TestDheeraj",
                CardNumber     = "1701002687431245",
                ExpirationDate = "09/12/2019",
                CVV            = "111"
            };
            var id = _paymentDetailRepository.AddPaymentDetail(_payment);

            Assert.True(id > 0, "failed");
        }