public async Task <ActionResult> ApproveQuestion(ApproveQuestionDTO questionModel) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } await _adminService.ApproveQuestionAsync(questionModel); return(Ok()); }
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); } }
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); } }