Beispiel #1
0
        public TopicDto DeleteTopic(int topicId)
        {
            var topic    = _dbContext.Find <Topic>(topicId);
            var topicDto = _runner.RunAction(topic).MapTopicToDto();

            return(!_runner.HasErrors ? topic.MapTopicToDto() : null);
        }
        public Flashcard Action(FlashcardQueryDto dto)
        {
            var flashcard = _dbContext.Find <Flashcard>(dto.FlashcardId);

            if (flashcard == null)
            {
                AddError("Flashcard entity not found");
                return(null);
            }

            if (flashcard.Stage == 0)
            {
                flashcard.Stage = 1;
            }

            if (dto.Success && flashcard.Stage < 5)
            {
                flashcard.Stage++;
            }
            else if (!dto.Success && flashcard.Stage > 1)
            {
                flashcard.Stage--;
            }

            return(flashcard);
        }
Beispiel #3
0
        public bool DeleteSection(int sectionId)
        {
            var section = _dbContext.Find <Section>(sectionId);

            _runner.RunAction(section);

            return(!_runner.HasErrors);
        }
Beispiel #4
0
        public bool DeleteFlashcard(int flashcardId)
        {
            var flashcard = _dbContext.Find <Flashcard>(flashcardId);

            _runner.RunAction(flashcard);

            return(!_runner.HasErrors);
        }