Example #1
0
        public async Task DeleteAnswerByIdAsync_DeleteWithId1_DeletesItem()
        {
            var numberOfItemsInDatabase = await _context.Answers.CountAsync();

            await _service.DeleteAnswerByIdAsync(1);

            _context.Answers.CountAsync().Result.Should().Be(numberOfItemsInDatabase - 1);
            _context.Answers.FindAsync(1).Result.Should().BeNull();
        }
        public async Task <IActionResult> DeleteConfirmed(int id)
        {
            var answerDto = await _answerService.GetAnswerByIdAsync(id);

            await _answerService.DeleteAnswerByIdAsync(id);

            return(RedirectToAction("Index", new { questionId = answerDto.QuestionId }));
        }