Beispiel #1
0
        public IActionResult AddPaymentType(PaymentType paymentType)
        {
            var existingUser        = _userRepository.GetUserById(paymentType.UserId);
            var existingPaymentType = _userRepository.GetPaymentTypeByAccountNo(paymentType.AccountNo);

            if (existingPaymentType == null && existingUser != null)
            {
                var newPaymentType = _userRepository.AddPaymentType(paymentType);
                return(Created("", newPaymentType));
            }
            else if (existingUser == null)
            {
                return(NotFound("That User does not exist"));
            }
            else
            {
                return(NotFound("A payment type already exists with this account number."));
            }
        }