Exemplo n.º 1
0
        public async Task <IActionResult> GetAll()
        {
            User user = _userService.GetByEmail(HttpContext.User.Identity.Name);

            if (user.Role != Role.Admin)
            {
                return(Unauthorized());
            }
            try
            {
                var questions = await _validateService.GetAllAsync();

                return(Ok(questions));
            }
            catch (TrojkatyCoreException ex)
            {
                return(BadRequest(new { Message = ex.Message }));
            }
        }