public async Task <int> AddFlashcardAsync(FlashcardListDTO flashcardListDTO)
        {
            var flashcardToAdd = _mapper.Map <Flashcard>(flashcardListDTO);
            await _repository.AddFlashcardAsync(flashcardToAdd);

            return(flashcardToAdd.Id);
        }
Beispiel #2
0
        public async Task <IActionResult> AddFlashcard([FromBody] FlashcardListDTO flashcardListDTO)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var result = await _flashcardsService.AddFlashcardAsync(flashcardListDTO);

            return(Ok(result));
        }