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); }
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()); }
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)); }