public IActionResult Add(CreditCard creditCard)
        {
            var result = _creditCardService.Add(creditCard);

            if (result.Success)
            {
                return(Ok(result));
            }
            return(BadRequest(result));
        }
        public IActionResult CreditCardAdd(CreditCard creditCard)
        {
            var result = _creditCardManager.Add(creditCard);

            if (result.Success)
            {
                return(Ok(result));
            }
            return(BadRequest(result.Message));
        }
示例#3
0
        public async Task <IActionResult> Add(CreditCard creditCard)
        {
            var result = await _creditCardService.Add(creditCard);

            if (result.Success)
            {
                return(Ok(result));
            }

            return(BadRequest(result));
        }
示例#4
0
        public IActionResult Add(CreditCard creditCard, [FromQuery] Boolean save)
        {
            //CreditCard creditCard = data["creditCard"].ToObject<CreditCard>();
            //Boolean save = data["save"].ToString();
            var result = _creditCardService.Add(creditCard, save);

            if (result.Success)
            {
                return(Ok(result));
            }
            return(BadRequest(result));
        }
示例#5
0
 public ActionResult Create(CreditCard card)
 {
     try
     {
         string[] userTemp = Session["LoginedUser"].ToString().Split(',');
         card.IsDeleted = false;
         card.User      = _userService.GetById(int.Parse(userTemp[0]));
         _creditCardService.Add(card);
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
示例#6
0
        public IActionResult Add(RentalPaymentDto rentalPaymentDto)
        {
            var result = _rentalService.Add(rentalPaymentDto.Rental);

            if (result.Success)
            {
                var paymentResult = _creditCardService.Add(rentalPaymentDto.CreditCard);
                if (!paymentResult.Success)
                {
                    //return Ok(paymentResult);
                    return(BadRequest(paymentResult.Message));
                }
                return(Ok(result));
            }
            return(BadRequest(result));
        }
示例#7
0
        public IActionResult Add(CreditCard creditCard)
        {
            var creditCardExists = _creditCardService.CreditCardExists(creditCard.CardNumber);

            if (creditCardExists.Success)
            {
                return(BadRequest(creditCardExists.Message));
            }

            var result = _creditCardService.Add(creditCard);

            if (result.Success)
            {
                return(Ok(result));
            }
            return(BadRequest(result));
        }
        public IResult Pay(Payment payment)
        {
            IDataResult <Rental> rentalResult = _rentalService.GetById(payment.RentalId);

            if (!rentalResult.Success)
            {
                return(new ErrorResult(rentalResult.Message));
            }

            if (rentalResult.Data.PayConfirm)
            {
                return(new ErrorResult(Messages.ExistPayConfirm));
            }

            var result = _bankPosService.Pay(payment.PayCard, rentalResult.Data.Amount);

            if (!result.Success)
            {
                return(new ErrorResult(result.Message));
            }

            rentalResult.Data.PayConfirm = true;
            result = _rentalService.Update(rentalResult.Data);
            if (!result.Success)
            {
                return(new ErrorResult(result.Message));
            }

            if (payment.IsSave)
            {
                CreditCard newCard = new CreditCard()
                {
                    CardHolder = payment.PayCard.CardHolder,
                    CardNumber = payment.PayCard.CardNumber,
                    CustomerId = payment.PayCard.CustomerId,
                    ExpYear    = payment.PayCard.ExpYear,
                    ExpMonth   = payment.PayCard.ExpMonth
                };
                result = _creditCardService.Add(newCard);
                if (!result.Success)
                {
                    return(new ErrorResult(result.Message));
                }
            }
            return(new SuccessResult(Messages.PaymentComplete));
        }
示例#9
0
        //[TransactionScopeAspect]
        public IResult Add(Collection collection)
        {
            CreditCard creditCard = new CreditCard
            {
                CardNo      = collection.CardNo,
                CvCode      = collection.CvCode,
                ExpityMonth = collection.ExpityMonth,
                ExpityYear  = collection.ExpityYear
            };

            _creditCardService.Add(creditCard);

            //Payment payment = new Payment { }
            //_paymentDal.Add();
            //// _rentalDal.Add();
            return(new SuccessResult(Messages.SuccessfulPayment));
        }
示例#10
0
        public string Add(Guid accountCode, CreditCard creditCard)
        {
            var account = accountRepository.Get(accountCode);

            return(creditCardService.Add(account, new DO.CreditCard(creditCard)));
        }