public async Task <IActionResult> GetByIdAsync(int id) { var card = await _repository.FindAsync(id); if (card == null) { return(NotFound()); } return(new ObjectResult(card)); }
public async Task IsCreationCardWithoutImageSuccessful(CreationCardDto dto) { var dbo = mapper.Map <CardDbo>(dto); var result = await cardRepository.AddAsync(dbo); var found = await cardRepository.FindAsync(result.Id); result.Answer.Should().BeEquivalentTo(dbo.Answer); result.Question.Should().BeEquivalentTo(dbo.Question); result.ImagePath.Should().BeNull(); found.Should().Be(result); }
public async Task <IEnumerable <Card> > GetAllCardsByEventIdAsync(long eventId) { var entities = await cardRepository.FindAsync(c => c.LotteryEventId == eventId); return(mapper.Map(entities, new List <Card>())); }