public IActionResult GetAll()
 {
     var result = _creditCardService.GetAll();
     if (result.Success)
     {
         return Ok(result);
     }
     return BadRequest(result);
 }
示例#2
0
        public IActionResult GetAllById(int customerId)
        {
            var result = _creditCardService.GetAll(customerId);

            if (result.Success)
            {
                return(Ok(result));
            }
            return(BadRequest(result));
        }
示例#3
0
        public IActionResult GetAll()
        {
            var result = _cardService.GetAll();

            if (result.Success)
            {
                return(Ok(result.Data));
            }
            return(BadRequest(result.Message));
        }
        public IActionResult CreditCardAll()
        {
            var result = _creditCardManager.GetAll();

            if (result.Success)
            {
                return(Ok(result));
            }
            return(BadRequest(result.Message));
        }
示例#5
0
 private IResult CheckIsCardValid(string cardNumber, DateTime expirationDate, string securityCode)
 {
     if (!_creditCardService.GetAll().Data.Any(
             c => c.CreditCardNumber == cardNumber &&
             c.ExpirationDate == expirationDate &&
             c.SecurityCode == securityCode))
     {
         return(new ErrorResult(Messages.CardInvalid));
     }
     return(new SuccessResult());
 }
示例#6
0
 private IResult CheckIsCreditCardExist(string cardNumber, string expirationDate, string securityCode)
 {
     if (!_creditCardService.GetAll().Data.Any(
             x => x.CreditCardNumber == cardNumber &&
             x.ExpirationDate == expirationDate &&
             x.SecurityCode == securityCode
             ))
     {
         return(new ErrorResult(Messages.NotExist + "credit card"));
     }
     return(new SuccessResult());
 }
示例#7
0
 private IResult CheckIsCreditCardExist(string cardNumber, string expirationDate, string cVV)
 {
     if (!_creditCardService.GetAll().Data.Any(
             cc => cc.CreditCardNumber == cardNumber &&
             cc.ExpirationDate == expirationDate &&
             cc.CVV == cVV
             ))
     {
         return(new ErrorResult(Messages.NotExist + "credit card"));
     }
     return(new SuccessResult());
 }
示例#8
0
        // GET: CreditCard
        public ActionResult Index()
        {
            if (Session["LoginedUser"] == null)
            {
                return(RedirectToAction(actionName: "Login", controllerName: "Login"));
            }
            if (string.IsNullOrEmpty(Session["LoginedUser"].ToString()))
            {
                return(RedirectToAction(actionName: "Login", controllerName: "Login"));
            }
            var list = _creditCardService.GetAll().ToList();

            return(View(list));
        }
        public IActionResult GetAllById(int customerId)
        {
            var userId = _customerService.GetById(customerId);

            if (userId.Data == null)
            {
                return(BadRequest());
            }
            var result = _cardService.GetAll(userId.Data.UserId);

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