public async Task <ActionResult <CardControlDTO> > PostCardControl(CardControl cardControl) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } CardControlDTO returnCardinformation = await _cardControlsService.ProcessCustomerCard(_context, cardControl); return(CreatedAtAction(nameof(GetCardControl), new { id = cardControl.Id }, returnCardinformation)); }
private CardControlDTO ReturnCardInformation(CardControl cardControl) { var lastFourDigitsArray = _operationsService.GetLastFourDigitsFromCard(cardControl.Cardnumber); var returnCardinformation = new CardControlDTO { Id = cardControl.Id, RegistrationDate = cardControl.RegistrationDate, Token = _tokenService.GenerateToken(lastFourDigitsArray, cardControl.CVV) }; return(returnCardinformation); }