Esempio n. 1
0
        public async Task <IActionResult> DeleteVerified(int id)
        {
            AnswerDto answerDto = await _answerService.GetByIdAsync(id);

            await _answerService.DeleteAsync(id);

            return(RedirectToAction(nameof(Index), new { questionId = answerDto.QuestionId }));
        }
Esempio n. 2
0
        public async Task DeleteAnswer_DeleteItemId1()
        {
            var countItemsImDataBase = await _context.Answers.CountAsync();

            await _service.DeleteAsync(1);

            _context.Answers.CountAsync().Result.Should().Be(countItemsImDataBase - 1);
            _context.Answers.FindAsync(1).Result.Should().BeNull();
        }
Esempio n. 3
0
        public async Task <IActionResult> DeleteAnswer(int?questionId, int?answerId)
        {
            if (questionId == null || answerId == null)
            {
                return(NotFound());
            }

            var user = await _userManager.GetUserAsync(User);

            var result = await _answerService.DeleteAsync(user.Id, answerId.Value);

            return(RedirectToQuestionOrFail(result, questionId));
        }
        public async Task <IActionResult> Delete(List <AnswerDto> answer)
        {
            await _answerService.DeleteAsync(answer);

            return(Success());
        }