Esempio n. 1
0
        public async Task <ActionResult> ApproveQuestion(ApproveQuestionDTO questionModel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            await _adminService.ApproveQuestionAsync(questionModel);

            return(Ok());
        }
Esempio n. 2
0
        public async Task ApproveQuestionAsync(ApproveQuestionDTO question)
        {
            var dbQuestion = await _quesitonRepository.GetQuestionAsync(question.QuestionId);

            if (dbQuestion != null)
            {
                dbQuestion.IsApproved   = question.QuestionApproved;
                dbQuestion.IsDeleted    = question.DeleteQuestion;
                dbQuestion.DateApproved = DateTime.UtcNow;

                await _quesitonRepository.ApproveQuestionAsync(dbQuestion);
            }
        }
Esempio n. 3
0
        public async Task ApproveQuestion(ApproveQuestionDTO questionModel)
        {
            var question = _mapper.Map <Question>(questionModel);

            if (questionModel.QuestionApproved)
            {
                question.DateApproved = DateTime.UtcNow;
                await _questionRepository.UpdateAsync(question);
            }
            else
            {
                question.IsDeleted = true;
                await _questionRepository.UpdateAsync(question);
            }
        }