示例#1
0
        public async Task SaveAndGet()
        {
            //arrange
            var card = new Card
            {
                CompanyKey   = "Acesso",
                ActivateCode = Guid.NewGuid().ToString()
            };

            card.LoadIds();

            //act
            await _repository.SaveAsync(card);

            var cardFound = await _repository.GetAsync(card.CardId);

            //assert
            Assert.NotNull(cardFound);
        }
示例#2
0
        public async Task <Card> GetCardAsync(Guid cardId, CancellationToken cancellationToken = default)
        {
            if (cardId == Guid.Empty)
            {
                throw new ArgumentNullException(nameof(cardId));
            }

            var card = await cardRepository.GetAsync(cardId);

            return(card.ConvertDtoCardToCard());
        }
示例#3
0
        public async Task <IActionResult> Get([FromBody] CardInfo card)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (card.UserId == Guid.Empty)
            {
                return(BadRequest());
            }

            var cards = cardRepo.GetAsync(card);

            return(Ok(cards));
        }