public async Task <IActionResult> Confirm(int id, bool publish) { User user = _userService.GetByEmail(HttpContext.User.Identity.Name); if (user.Role != Role.Admin) { return(Unauthorized()); } try { var question = await _questionService.GetQuestionAsync(id); if (question == null) { throw new TrojkatyCoreException($"Cannot find question on id {id}"); } var v = await _validateService.ConfirmValidationAsync(question, publish); return(Ok(_mapper.Map <ValidateResponseDTO>(v))); } catch (TrojkatyCoreException ex) { return(BadRequest(new { Message = ex.Message })); } }